Telegram

Introduction

Telegram is a pure instant messaging — simple, fast, secure, and synced across all your devices. Through Telegram, brands can engage with their customers with rich messaging that they can easily engage with.
 

MoEngage <> Telegram

MoEngage and Telegram integration via MoEngage Connectors allows you to leverage advanced segmentation, predictive capabilities, personalization, and triggering features to message your users in Telegram via Telegram Bot through the Telegram APIs.

Integration

Prerequisites

Telegram allows both promotional and non-promotional messaging to users as long your brand has secured users’ consent. To send messages to users, you must meet one of two conditions:

  • Users who have added your Telegram bot  
  • Users who haven’t added your Telegram bot but have sent a message to your Telegram bot (excluding users who have blocked your Telegram bot).

REQUIREMENT DESCRIPTION
Telegram bot A Telegram bot is required to use this integration

When sending Telegram messages, your messages will all be associated with your Telegram bot, resulting in users seeing your bot details (name, link)
Channel access tokens The channel access token will allow you to send messages to users that have added your Telegram. 
Telegram user IDs You will need to have users’ Telegram IDs (this ID is different from users’ usernames) to send messages on Telegram.

Once a user adds your Telegram official account, you can access the user’s Telegram ID through Telegram's Users API.

Note-

  • You can send personalised campaigns only to the users for which you have a user identifier (phone number).
  • Telegram bots do not have phone number for your users by default. The number needs to be shared with your bot by the end users. You should either use Telegram API methods instead or ask it explicitly from the user (by sending a broadcast message on Telegram ID).  

Step 1: Collect customer Telegram IDs

To send messages in Telegram, you need to collect your users’ Telegram IDs to identify your user and interact with them consistently. Telegram IDs are not the same as the user’s Telegram usernames. Telegram IDs are generated by Telegram and can be used when interacting with Telegram's APIs

This endpoint will return a list of Telegram IDs for all users who have friended your Telegram official account or sent your account a message and have not blocked you.

Step 2: Save user's Telegram ID on MoEngage

Once you obtain a list of Telegram IDs, you need to add them to MoEngage. 

  • If you have a user identifier such as phone number, you can add them on MoEngage as a telegram_id - custom tracked user attribute/property (phone number). You can save this data to MoEngage either using:
  • If you do not have any user identifier (meaning the user has not shared his personal details with your bot), you can upload them as Anonymous users

Step 3: Create Connector Campaign on MoEngage to send Telegram Message

To create a connector campaign on MoEngage, 

1. Navigate to Create Campaign >> Connectors >> Custom and choose delivery type most suitable to your needs 

Screenshot_2022-02-21_at_10.48.46_PM.png

 

2. Choose Segment of users for whom telegram_id exists (You can combine with other Segment criteria) 

3. On step 2 of the campaign, 

  • Select method as POST
  • Add Webhook URL as : https://api.telegram.org/bot<botID>/sendMessage
  • In Headers, use
    • Content-Type as application/json 
  • In Body, choose Raw and use the content depending on what kind of message object you want to send out. You can look at different message objects here.

Screen_Shot_2022-03-02_at_12.42.25_PM.png

Here are few content samples for different message types:

Text Image File

 


    "chat_id": "{{UserAttribute['telegram_id']}}",
    "text":"Hello world"

 

4. At this point, your campaign should be ready to test and send. You can also test your connector configuration using the Test functionality available on Step 2 of Create Connector Campaign

Screen_Shot_2022-02-22_at_11.12.42_AM.png

If your test user successfully receives the message, your set-up is good to go. You can go ahead and Publish the campaign.

 

Was this article helpful?
0 out of 0 found this helpful