Tiledesk Developer Hub
WebsiteCommunityTutorialsGet started
  • Introduction
  • Community
  • Ask for Support
  • Public Roadmap and Changelog
  • Tutorials
  • Widget
    • Widget SDK
    • Javascript API: Methods
    • Javascript API: Attributes
    • Javascript API: Listeners/Events
    • Widget Authentication
    • Widget Angular integration
    • Widget React integration
    • Widget for Android with WebView
    • Widget for iOS with WKWebView
    • Widget for Flutter with WebView
    • Widget for React with WebView
    • Widget for Wix Website platform
    • Tutorials
      • Hide widget
      • Show/Hide widget programmatically
      • Force widget loading without user interaction
      • Mobile positioning
      • Custom size (width/height)
      • Installing widget on selected pages
    • Conversation Embedded Apps
      • Payment App Tutorial
      • Prechat form App Tutorial
    • Advanced
      • Preset the Widget on a specific Department
      • Authentication Flow
      • Widget protocol specs
      • Prechat Form JSON specs
      • Prevent multiple conversations
      • Old versions
        • Web SDK v4
  • External Chatbot
    • Introduction
    • Hello World tutorial
    • Chatbot to Human handoff
    • Send Text Buttons
    • Advanced Tutorials
      • Introduction
      • Tutorial 1 - Dialogflow as external chatbot
      • Tutorial 2 - Buttons and images
      • Tutorial 3 - Automatic human handoff with fallback intent
      • Tutorial 4 - Explicit Human handoff with user intent
      • Tutorial 5 - Gracefully handling operating hours during handoff
      • Generate Dialogflow Google Credentials file
    • Rasa tutorials
      • Rasa Tutorial 1 - Rasa as external chatbot
  • Resolution bot
    • Introduction
    • Quickstart
    • Webhook service
    • Rich messages
    • Tutorials
      • Chatbot chooser (multilanguage)
      • Department chooser
      • Order info (webhook)
  • APIs
    • REST APIs
      • Introduction
      • Authentication
      • Requests
      • Leads
      • Messages
      • Activities
      • Projects
      • Team
      • User
      • Analytics
      • Canned responses
      • Tags
      • Events
      • Jwt
      • Labels
      • Images
      • Files
      • Segments
      • Chatbots
      • Knowledge Bases
        • Knowledge Base
        • Contents
        • Question & Answer
      • Management Api
        • Departments
        • Groups
    • NodeJS SDK
    • Webhooks
      • Subscriptions
    • Conversation Messages APIs tips
    • Realtime API
    • JWT Authentication
      • JWT Custom authentication Tutorial
    • Tutorials
      • REST API
        • Sending and receiving messages with Tiledesk APIs
        • PHP Tiledesk REST API example
        • Import multiple messages into Tiledesk using REST APIs from third party app
      • Webhooks
        • Custom Request assignment
        • Request transcript on close
  • Apps
    • Build Custom App - Quick start
    • External Channels integration flow diagram
    • Telegram integration tutorial
  • Dashboard & AgentChat SDK
    • Dashboard SDK
    • Agent Chat SDK
  • Architecture
    • Architecture overview
    • Components list
    • Bot Design diagram
    • Multi Channel Message Flow
  • Installation
    • Installation
    • Running Tiledesk using Docker Compose
    • Running Tiledesk with Kubernetes using Helm
    • Choosing Hardware
  • Configuration
    • Chat21 channel configuration
    • Email parameters and templates configuration
    • Configure the logging system
Powered by GitBook
On this page
  • Introduction
  • Steps
  • Create a Tiledesk Project
  • Create a Telegram Bot
  • Configure the Webhook
  • Set the Webhook endpoint for Telegram
  • Subscribe to a Webhook on Tiledesk
  • Test the integration

Was this helpful?

  1. Apps

Telegram integration tutorial

PreviousExternal Channels integration flow diagramNextDashboard SDK

Last updated 1 year ago

Was this helpful?

Introduction

The Telegram Integration for Tiledesk allows to expand the offer of customer service through the exchange of messages between Telegram and Tiledesk support. This integration allows you to connect your company's Telegram bot to your Tiledesk account, thus creating a tunnel between the two platforms. Therefore customers can reach your support simply by writing to your Telegram bot and these messages will be delivered to the Tiledesk webchat, along with messages from other channels. Your agents will have a single work environment.

Steps

The following are the steps involved in our tutorial:

  1. Create a Tiledesk Project

  2. Create a Telegram Bot

  3. Configure the Webhook

  4. Set the Webhook endpoint for Telegram

  5. Subscribe to a Webhook on Tiledesk

  6. Test the integration

Create a Tiledesk Project

Now choose a name for your project (i.e. Telegram Tutorial) and click the "CREATE PROJECT" button (leave all the options on their default values).

Nice, your project is ready.

Create a Telegram Bot

Now type /newbot to create a new bot or choose from the options proposed by the bot.

So, choose a name for your bot and a username also, following the instruction given by @BotFather.

Your bot is now operative. Do you see the token? We will need it shortly.

Configure the Webhook

Use the fork button and choose a name for your app.

The app is forked and ready to run.

Now move back to your Tiledesk project's Settings > Project Settings > General section and copy the Project Id

Paste the Project Id in the index.js file of your NodeJS app on Replit, as shown in figure:

Now move back (again) to your Tiledesk project's Settings > Project Settings > Developer section. We will generate a new secret key that will be used to sign your JWT token. Press "GENERATE SHARED SECRET" button, but note that every time you generate a new secret the previous one will be no longer valid and you have to replace wherever you used it. Then click on "GENERATE".

That's your shared secret key, click on "Copy".

Paste the Secret Key in the index.js file of your NodeJS app on Replit, as shown in figure:

Set the Webhook endpoint for Telegram

Now it's time to use the token provided by @BotFather earlier. Copy and paste it in the index.js file of your NodeJS app on Replit, as shown in figure:

In the same file we need to set also the webhook endpoint for Telegram, that is the endpoint related to your webhook to which Telegram will send messages.

Click on "Run" button to start the server, then copy the URL in the red circle in index.js, inside the function setWebhookEndpoint(), adding "/telegram" at the end of the URL, like in figure:

Subscribe to a Webhook on Tiledesk

We almost done, the last thing to do is to add a subscription for Tiledesk. Let's go!

Move to your Tiledesk project's Settings > Project Settings > Developer and click on the "MANAGE WEBHOOK" button.

Then click on "ADD SUBSCRIPTION" button.

In the New Subscription popup select the Message Create (only for Telegram channel) option from the dropdown and type the Webhook Target that is the same URL than before, adding "/tiledesk" at the end of the URL, like in figure:

Now click on "CREATE SUBSCRIPTION" button.

Well, the Webhook is now configured!

Test the integration

Finally we can test the Telegram integration. Move to Telegram app and search the bot created later (search it for name or username or just click on the link present on @BotFather). Then click on "Start".

A default message "/start" will be sent to Tiledesk webchat and an agent can now reply.

Message sent from Tiledesk will be delivered in the Telegram Bot chat, like any other conversation.

Done! The integration is completed.

See you on our next tutorial!

Do you have suggestions on this article? Please send us your feedback writing an email to info@tiledesk.com

First of all create a Tiledesk project. Log in to the , then click on "Add project".

Create a new project
Choose the project name

Well, let's move on the Telegram app, on the desktop version or on the mobile one. Search and start the conversation with .

New telegram bot

We use the service to fast create our own NodeJS web application endpoint. Fork the tutorial application, available at this url: .

Fork Replit project
Tiledesk Project Id
Paste Project Id
Shared Secret
Copy Shared Secret
Paste Shared Secret
Paste Telegram token
Endpoint Url
Manage Webhook Button
Add subscription
Create subscription configuration

What you will see next will be the secret associated with your webhook. Keep the secret to interact with webhook trough webhook’s APIs (see ). We don't need it for our goal, but save it in a safe place because it will only be displayed once.

Webhook secret
Start conversation on Telegram
Tiledesk chat
Telegram chat

you can find an example code to integrate with Twilio (WhatsApp) based on the same principles treated in this tutorial

And , another one example code, this time for Facebook Messenger integration.

If you have any problems do not esitate to write us on our !

Tiledesk Console
@BotFather
Replit
https://replit.com/@GiovanniTroisi/tiledesk-telegram-tutorial-app
here
Here
here
Community forum