With over 200 million active monthly users, Telegram is a free messaging app with a focus on speed and security. Thanks to its distributed infrastructure and encryption, Telegram is fast and secure. It can be used on multiple devices at the same time — messages are synced seamlessly across any number of phones, tablets or computers. Telegram allows businesses to send messages, photos, files of any type, as well as use other rich capabilities like quick replies, postbacks, compound messages and carousels.
Telegram supports a wide variety of capabilities as seen in the channel capabilities grid. Below is a detailed view of each capabilities.
Delivery events allow you to track deliveries of Sunshine Conversations messages to Telegram by subscribing to the conversation:message:delivery:channel
webhook. Failures to deliver a message to Telegram can be detected by subscribing to the conversation:message:delivery:failure
webhook.
The Telegram message IDs associated with each Sunshine Conversations message are available in delivery event payloads in the externalMessages
property.
Telegram Messenger is available for smartphones, tablets, desktop computers, and as a web-based application. Your messages automatically sync between your devices.
Open Telegram, and then follow the instructions to create your account.
Note: You need an existing account to log in to Telegram Web. You cannot create an account from within Telegram Web.
Telegram bots are third-party AI applications that perform functions such as interacting with users, relaying weather information, and listing news articles. These bots run within Telegram.
This example uses BotFather to create a bot and the access tokens, and then uses that bot to send messages from Telegram to Sunshine Conversations.
For more information on Telegram bots, see Bots: An introduction for developers.
To create a bot
Search for @BotFather and start a chat with the bot.
In your chat window, type /newbot and follow the instructions on the screen.
When you have successfully created a bot, BotFather displays a “Done! Congratulations on your new bot.” message.
Copy the secure token from that message.
Sunshine Conversation uses that secure token to integrate with Telegram.
Once you have created the bot, all you have to do is enter the bot’s access token on the integration page. Sunshine Conversations now relays any message it receives to your business systems.
To integrate Telegram with Sunshine Conversations
In the Sunshine Conversations dashboard, click the app where you want to integrate Telegram or create a new one.
Click Connect Integrations.
Expand the Customer Channels section and click Telegram.
Click Connect.
If you have not already created a Telegram bot, click Create a Bot and follow the instructions above.
Enter a unique name for this integration.
Paste the secure token you received when creating a bot into Bot Token.
Click Authenticate your Telegram Bot.
To test your integration
In the Telegram app, start a chat with the bot you created.
If you don’t remember your bot’s name, open the chat history with BotFather.
Enter a test message such as This is a test.
In the Sunshine Conversations dashboard, open the app where you integrated Telegram and click Logs.
If you see something similar to this, your integration is successful.
Once your server is listening for requests, create a webhook to receive the message.
In the Sunshine Conversations dashboard, open the app where you integrated Telegram and click Connect integrations.
From the categories list on the left side, click API & Webhooks and then click Webhooks.
Click Connect and then click Create a webhook.
Enter your webhook URL.
Check the Conversation message trigger and then click Create webhook.
To test your webhook
In the Telegram app, start a chat with the bot you created.
Enter a test message such as This is another test.
In the Sunshine Conversations dashboard, open the app where you integrated Telegram and click Logs.
If you see something similar to this, your webhook is receiving your messages.
To send a user to your bot, you can direct them to https://telegram.me/<your_bot_username>
. Telegram users can also search for your bot by its username, which is obtained while creating a bot with BotFather. Once they have added your bot to their contacts, your bot will act as any other Telegram user. Any user will be able to send normal text messages to your bot or any of the supported file formats (documents, images, sound). If the user sends a file, the message will contain a link to the file that was sent.
When you reply from any of the configured backend channels, Telegram users will receive the message as though it was coming from the bot.
When used with Telegram, message actions work as expected. A button with type link
will bring the user to a web page, while postback buttons will trigger any Sunshine Conversations webhook listening to the postback
trigger.