Integrating Telegram into DMflow

Telegram is known for its openness and powerful Bot API. Through the following steps, you can quickly create and connect a Telegram bot to the DMflow platform.

Step 1: Find BotFather

All Telegram bots are managed by the “Father of Bots” — BotFather.

  1. Open Telegram App.
  2. Enter BotFather in the search bar.
  3. Click the account with a blue checkmark verification and press Start.

Step 2: Create New Bot

  1. Enter command /newbot in the chat.
  2. Set Display Name (Name): BotFather will ask you to enter the bot’s name (e.g., My Super Bot).
  3. Set Username: Next, enter a unique Username. Note: Must end with bot (e.g., dmflow_demo_bot).
  4. Upon success, BotFather will give you an API Token (red masked area in the image below). Please keep this Token safe and do not leak it.

Step 3: Group Settings (Privacy Mode)

If you want the bot to receive all messages in a group (not just commands starting with /), you need to disable privacy mode.

  1. Enter /mybots to BotFather.
  2. Select your bot.
  3. Click Bot Settings -> Group Privacy.
  4. Select Turn off.

Step 4: DMflow Backend Settings

  1. Login to DMflow system.
  2. Go to Settings -> Third-party Integration -> Telegram.
  3. APP_ID: Fill in the pure numbers before the colon in the Token (e.g., 58XXXXXXXX).
  4. Token: Fill in the complete Token string.
  5. Check Enable and save. The system will automatically verify if the Token is correct.

Advanced: Manual Webhook Operation

Usually, DMflow will automatically set up the Webhook for you, but if you need manual operation, you can refer to the following API:

Set Webhook:

{
    "url":"{{Webhook URL}}"
}
https://api.telegram.org/bot/setWebhook?url={{Webhook URL}}

Delete Webhook:

https://api.telegram.org/bot{{token}}/deleteWebhook

Please replace {{token}} and {{Webhook URL}} with your actual values.