How to Integrate Odoo 17 With Telegram

July 1, 2024

Odoo’s pre-built connectors and APIs offers smooth odoo telegram integration with well-known third-party programs and services. You can integrate with Telegram chat app with your Odoo instance with the Odoo Telegram integration. Odoo Telegram integration makes sending and receiving messages between Telegram users and your Odoo system possible, facilitating easy communication and process of automation. In this blog, we will explore the complete process of integrating Odoo with Telegram. also the the steps to create a Telegram Bot and obtain the BotToken. Here are the steps to how to integrate odoo 17 with Telegram and build a bot on Telegram and fetch the BotToken:

Odoo Telegram Integration

Telegram doesn’t support direct access through APIs to personal accounts. And you can’t retrieve incoming messages straight from your personal Telegram account. The only official method to communicate with Telegram programmatically is through the Telegram Bot API, which needs a bot token to authenticate and grant permission for your application to access Telegram data.

How to Build a Bot on Telegram and Fetch BotToken Step-by-step guide

  1. Search for the user “BotFather” on Telegram.
  2. Open a new conversation window on Telegram and search for BotFather. To start a new bot, send the command “/newbot”.
  3. to select a name You will prompted by BotFather (such as OdooTestBot) and a special username (such as OdooTestBot).
  4. BotFather gives a token for your new bot after you supply a name and username.

Retrieve Incoming Messages from Odoo Instantaneously:

By setting up a webhook URL on your Odoo server, you may retrieve user messages sent to your bot instantly

example: – Creating a controller to configure a webhook.

from odoo import http, _

import json
class WebhookControllerTelegram(http.Controller):
@http.route('/telegram/webhook/receiver', type='json',auth='public',methods=['POST'], csrf=False)
def handler_webhook(self, **post):
load_data = json.loads(
print("load_data >>>", load_data)

Create a function that registers the webhook in Telegram using their setWebhook API.

set_webhook_url = f'{bot_token}/setWebhook?url={webhook_url}'

Enter enter the controller route with the domain and get the token you obtained from “BotFather” as the value of “bot_token” (Note: Webhook only supports HTTPS). For test cases, use “ngrok” and pass the server’s value as “wehook_url.” The webhook is successfully registered in Telegram when the response is True. It trigger whenever a user messages your bot, and you retrieve the message from the JSON value.

Use the getWebhookInfo API in Telegram to view your webhook status.

example: –

# webhook info Check

webhook_info = f'{bot_token}/getWebhookInfo'
response =
print("Webhook Info Response:", response.json())

You can create a message handling function in Odoo to process incoming messages and take necessary action based on the content of the messages when Telegram provides an update to your webhook URL.

example: –

def handler_webhook(self, **post):  

load_data = json.loads(
print("data >>", load_data)
if load_data:
data = load_data['message']['from']
message = load_data['message']['text']
print("Data Get >>", data)
data = {
'contact': data,
'message': message,
'chat_id': data.get('id')
record = self.env['message.history'].with_user(SUPERUSER_ID).create(data)
print("record", record)

To distinguish users, you can store Telegram messages in a record in your custom model that has their distinct chat_id.

Using polling to retrieve incoming messages from Odoo:

Instead of using a webhook, you can poll Telegram for changes using the getUpdates API. This implies that in order to check for new messages, your bot will ping the Telegram API on a regular basis. Receiving updates via polling is less effective and may cause delays, particularly if the interval between polls is extended. It works better for research and development.

We can just access the getUpdates API during a predetermined time window to use scheduled activities rather than polling.

Message sent from Odoo:

The’sendMessage’ API on Telegram gives users to send text messages to one another using a bot token.


message = "We appreciate your reaching out to us."

url = f'{bot_token}/sendMessage'
data = {'message_id': chat_id, 'text_data': message}
response =, data=data)
print("response >>>", response.json())

In this process, the message is sent to the specified Chat ID (a unique ID that obliges you to distinguish between multiple chats). and Additionally, Telegram offers an API for sending many kinds of messages.


send photo, sent Audio, send document, send sticker, send video, send voice

(Telegram’s document includes thorough explanations of every API.)

Advantages Of Integrating Odoo With Telegram

Your company can build up from integrating Odoo with Telegram in a number of ways, improving operations, efficiency, and communication.

For instance:

Chat with Customers: By implementing live chat functionalities or other pertinent features, you can build up a Telegram chatbot to manage customer support, commonly asked questions, and requests from website visitors or customers.

Task Management: To manage tasks and to-do lists straight from the messaging app, build a Telegram bot. Without ever leaving Telegram, by using this bot  you can add projects, set deadlines, and get reminders.

Sales and CRM Integration: To manage customer interactions and collect leads straight from Telegram, integrate Telegram with Odoo’s CRM module.

Stock Level Notifications and Inventory Alerts: stay informed about stock levels and inventory levels so you will promptly replenish products.

Order tracking: customers to follow the status of their orders and get updates on delivery progress, integrate Telegram with your Odoo e-commerce platform.

Survey and Feedback: Do use Telegram’s interactive features to administer surveys and collect feedback from clients.

to learn more about how to integrate telegram with odoo visit our website

"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *