Telegram integration tutorial

The Telegram Integration for Tiledesk allows you to expand customer service by exchanging messages between Telegram and Tiledesk support. This integration connects your company's Telegram bot to your Tiledesk account, creating a tunnel between the two platforms. Customers can reach your support by messaging your Telegram bot; those messages will be delivered to the Tiledesk webchat along with messages from other channels, so agents have a single work environment.

Steps

The following are the steps involved in this tutorial:

1

Create a Tiledesk Project

  1. Log in to the Tiledesk Console: https://panel.tiledesk.com/ and click "Add project".

  1. Choose a name for your project (e.g., "Telegram Tutorial") and click the "CREATE PROJECT" button (leave default options).

Your project is now ready.

2

Create a Telegram Bot

  1. Open Telegram (desktop or mobile) and start a conversation with @BotFather: https://t.me/botfather.

  2. Send the command /newbot to create a new bot, then follow the prompts to choose a name and a username.

Your bot will be created and BotFather will provide a token — keep this token; you'll need it soon.

3

Configure the Webhook

  1. Use Replit to quickly create a Node.js endpoint. Fork the tutorial app: https://replit.com/@GiovanniTroisi/tiledesk-telegram-tutorial-app#index.js and give it a name.

  1. In the Tiledesk Console, go to your project's Settings > Project Settings > General and copy the Project Id.

  1. Paste the Project Id into the index.js file of your Replit app.

  1. In Tiledesk Console, go to Settings > Project Settings > Developer and press "GENERATE SHARED SECRET". Note: generating a new secret invalidates previous ones.

  1. Click "Copy" for the shared secret and paste it into the index.js file on Replit.

4

Set the Webhook endpoint for Telegram

  1. In the index.js file on Replit, paste the Telegram token you got from BotFather.

  1. Click "Run" to start the server. Copy the URL shown in index.js inside the function setWebhookEndpoint(), and append "/telegram" to that URL.

5

Subscribe to a Webhook on Tiledesk

  1. In Tiledesk Console, go to Settings > Project Settings > Developer and click "MANAGE WEBHOOK".

  1. Click "ADD SUBSCRIPTION".

  1. In the New Subscription popup:

    • Select "Message Create (only for Telegram channel)".

    • Set the Webhook Target to the same Replit URL as before, but append "/tiledesk" to it.

  1. Click "CREATE SUBSCRIPTION". You will be shown a webhook secret — save it securely (it is displayed only once). See webhook APIs: https://developer.tiledesk.com/apis/webhooks/subscriptions

The Webhook is now configured.

6

Test the integration

  1. In Telegram, open your bot (by name, username, or via the link provided by @BotFather) and click "Start".

  1. A default message ("/start") will be sent to the Tiledesk webchat — an agent can now reply.

  1. Messages sent from Tiledesk will be delivered to the Telegram Bot chat as normal conversations.

Done — the integration is completed.

Additional example projects:

  • Twilio (WhatsApp) example: https://replit.com/@andrealeo83/tiledesk-whatsapp-twilio-app

  • Facebook Messenger example: https://replit.com/@andrealeo83/tiledesk-facebook-app#index.js

If you have any problems, post on the Community forum: https://tiledesk.discourse.group/

Do you have suggestions on this article? Send feedback by email to [email protected]

Last updated 2 years ago