- Create an account on https://botfather.io/accounts/login/
- Message
@BotFather
in telegram
- Go through the bot creation process with
/start
. At the end you will receive a token, which you will need later on.
- Add the bot to your channel of choosing as an admin.
- Write a message so their is message history.
- Go to
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
and copy the id
from the chat response.
- You send fetch post requests that have the token in the url and a chat id in the request body, as shown in the example below.
- You can use Code By Zapier, with a Javascript input to run a similar snippet.
const template = `
❤️ <b>${inputData.name}</b> has been <b>Approved</b> to join Camp.
`;
await fetch(`https://api.telegram.org/bot${inputData.token}/sendMessage`, {
method: 'POST',
cache: 'no-cache',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
chat_id: inputData.chatId,
text: template,
parse_mode: 'HTML',
disable_web_page_preview: true,
})
}).then(res => res.json()).then(json => callback(null, json)).catch(callback);