| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Lines of code | 1330 |
| Technical Name |
sm_telegram |
| License | OPL-1 |
Telegram Integration Advanced
Send Telegram messages, PDFs, images & scheduled notifications directly from any Odoo record
Module Video Overview
Features
1 Create bots easilyCreate and configure multiple Telegram bots directly within Odoo. Paste your BotFather token, verify the bot, and set up the webhook — all in one click. Supports multi-company: each company gets its own bot. |
|
|
2 Configure per modelEnable Telegram sending per Odoo model (Sale Order, Invoice, etc.). Whitelist allowed PDF reports, restrict which users can send, and set default templates — all from a single config screen. |
3 Send from chatterA Send Telegram button appears directly in the chatter of configured models. Open the wizard, pick recipients, write your message (or load a template), attach files, and send — without leaving the record. |
|
|
4 Dynamic templates
Build reusable message templates with Jinja2 variables: |
5 Inline keyboard buttonsAdd clickable URL buttons directly in your Telegram messages: View Order, Pay Invoice, Visit Website. Configurable per template with row management. |
|
|
6 PDF & file deliveryAttach QWeb PDF reports with one click. Send images as Telegram photos, other files as documents — the module detects the type automatically. Reports are whitelisted per model for security. |
7 Schedule & auto-retrySchedule messages for a future date/time. A background cron job sends them when due — and automatically retries failed deliveries up to a configurable max retry count. Never miss a message. |
|
|
|
8 Full delivery trackingEvery message is logged with complete details: recipient, status (sent/failed/scheduled), timestamps, error info. Manual retry from the log view. Chatter summary posted on the source document. |
9 Auto contact mapping
When a Telegram user sends |
|
|
10 Bulk sendingSend the same message to up to 50 recipients at once. Templates are rendered per-partner, so each recipient gets personalized content with their own name and details. |
And much more...
Multi-CompanyEach company gets its own bot. The system auto-selects the correct verified bot for the current company. |
User Access ControlRestrict which users can send Telegram per model. If no users specified, everyone can send. |
Secure WebhookAuto-generated secret token for webhook validation. Only verified requests from Telegram are processed. |
Template PreviewLive preview and one-click test render for templates. See exactly what your recipients will receive. |
Manual RetryRetry any failed message directly from the message log view. No need to recreate the message from scratch. |
Global SettingsConfigure default bot, enable/disable auto-retry, and set max retry count from Odoo’s Settings screen. |
Chatter Audit TrailAfter sending, a summary note is posted on the source document showing which recipients succeeded and which failed. |
Markdown & HTMLFormat messages in Markdown or HTML. Bold, italic, links, code blocks — all supported natively by Telegram. |
Report per TemplateAttach a PDF report action directly in the template. On send, the report is auto-generated and attached to the message. |
Support
We provide free bug fixes and updates for all our modules. If you need help, please submit a support request through the Odoo Apps support page. Our team is always ready to assist you.
Telegram Integration Advanced — Documentation
Table of Contents
1. Getting Started
Prerequisites
Before installing, make sure your environment meets these requirements:
Warning
Telegram only accepts HTTPS webhook URLs. Your Odoo instance must be accessible via a public HTTPS domain.
Tip
If you are developing locally, use ngrok to create a temporary HTTPS tunnel to your local Odoo instance.
Installation
- Upload the sm_telegram module folder to your server's custom addons directory.
- Restart the Odoo service to detect the new module.
- Navigate to Apps menu, click Update Apps List.
- Search for "Telegram Integration Advanced" and click Install.
Note
After installation, a new Telegram top-level menu will appear in the main menu bar. All bot management, templates, model configs, and message logs are accessible from there.
2. Creating a Bot
To get started, you need to obtain an official Telegram Bot Token from BotFather.
Step 1: Talk to BotFather
- Open Telegram on your phone or desktop.
- Search for @BotFather and start a conversation.
- Send the /newbot command.
- Follow the instructions — choose a name and a username for your bot.
- BotFather will provide you with a unique API Token.
Important
Keep your token secure! Anyone with access to this token can control your bot. Never share it publicly or commit it to a public repository.
Step 2: Register Bot in Odoo
Navigate to Telegram → Bots → New.
Fill in the following fields:
Token: Paste the API Token you received from BotFather. Company: Select the company this bot belongs to. Each company can have its own bot. Click the Verify Bot button.
The system calls the Telegram getMe API to validate the token and automatically fetches the bot's name and username.
Click the Setup Webhook button.
This registers your Odoo server URL with Telegram via the setWebhook API. A cryptographically secure secret token is auto-generated for webhook validation.
Tip
You can see the bot status change to Verified and the webhook URL populated automatically. If verification fails, double-check your token and that web.base.url is set correctly in Settings → Technical → System Parameters.
3. Model Configuration
Before users can send Telegram messages from a specific model (e.g. Sale Order, Invoice), an administrator must enable it.
Setup
- Navigate to Telegram → Model Configuration → New.
- Configure the following fields:
Model: Select the Odoo model (e.g. sale.order, account.move, res.partner). Allowed Reports: Whitelist which QWeb PDF reports can be sent via Telegram for this model. If left empty, all PDF reports for the model are available. Allowed Users: Optionally restrict which users can send Telegram messages for this model. If left empty, all users can send. Default Template: Optionally select a template that will be auto-loaded when a user opens the send wizard for this model.
Note
Once a model is configured, the "Send Telegram" button will automatically appear in the chatter of all records of that model.
4. Contact Mapping
Telegram uses chat IDs to identify users. The module handles mapping automatically.
How It Works
- Your customer opens Telegram and searches for your bot (e.g. @YourCompanyBot).
- They send the /start command.
- The webhook controller receives the update and automatically:
- Extracts the Telegram username and chat_id from the message.
- Searches for a res.partner with a matching telegram_username field.
- Writes the telegram_chat_id on that partner record.
Tip
To prepare contacts, set the Telegram Username field on partner records (found in the Telegram tab on the partner form). When the customer sends /start, the mapping happens automatically — zero manual work.
Partner Fields
Two fields are added to res.partner:
| Field | Description |
|---|---|
| telegram_username | The contact's Telegram username (without @) |
| telegram_chat_id | Auto-populated when the contact sends /start to the bot |
5. Sending Messages
From the Chatter
- Open any record (Sale Order, Invoice, Partner, etc.) that has a configured model.
- In the chatter, click the Send Telegram button.
- The Send Wizard opens with the following options:
Recipients: Select one or more partners who have a telegram_chat_id. You can send to up to 50 recipients at once. Template: Select a pre-configured template, or leave empty to write a custom message. If the model has a default template, it is auto-loaded. Message: The message body. If a template is selected, it is rendered with Jinja2 variables and pre-filled here. You can still edit it before sending. Parse Mode: Choose between Markdown, HTML, or Plain Text formatting. Report: Optionally attach a QWeb PDF report (only whitelisted reports are shown). Attachments: Attach any ir.attachment files. Images are automatically sent as Telegram photos, other files as documents. Scheduled Date: Leave empty to send immediately, or set a future date/time for deferred delivery. - Click Send.
Tip
After sending, a summary is posted as a chatter note on the source document, showing which recipients succeeded and which failed.
6. Message Templates
Templates let you create reusable, dynamic messages with variables and buttons.
Creating a Template
- Navigate to Telegram → Templates → New.
- Configure the following:
Name: A descriptive name for the template (e.g. "Order Confirmation"). Model: The Odoo model this template applies to. Body: The message body using Jinja2 template syntax. Parse Mode: Markdown or HTML for rich text formatting. Report: Optionally attach a PDF report action — it auto-generates on send.
Available Variables
These variables are available inside the template body:
| Variable | Description |
|---|---|
| {{ object }} | The source record (e.g. the Sale Order) |
| {{ object.name }} | Record name (e.g. SO001) |
| {{ partner }} | The recipient partner record |
| {{ partner.name }} | Partner name |
| {{ company }} | Current company record |
| {{ company.name }} | Company name |
| {{ user }} | Current user record |
| {{ user.name }} | Current user name |
Example template body (Markdown):
*Order Confirmation* 🎉
Hello **{{ partner.name }}**,
Your order **{{ object.name }}** has been confirmed!
Total: {{ object.amount_total }} {{ object.currency_id.name }}
Thank you for your business.
— {{ company.name }}
Inline Keyboard Buttons
Add clickable URL buttons that appear below the message in Telegram:
- In the template form, go to the Buttons tab.
- Click Add a line and fill in:
Label: The button text (e.g. "View Order") URL: The destination URL Row: Row number (buttons on the same row appear side by side)
Tip
Use Preview to see exactly how the rendered message will look, and Test Render to validate Jinja2 syntax before sending.
7. Scheduling & Auto-Retry
Scheduled Messages
Instead of sending immediately, set a scheduled date/time in the send wizard. The message will be saved with status "scheduled" and a background cron job will process it when the time comes.
Auto-Retry for Failed Messages
If a message fails to send (network error, Telegram API downtime, etc.), the system can automatically retry it.
Configuration: Navigate to Settings → General Settings → Telegram.
| Setting | Description |
|---|---|
| Default Bot | Auto-selected when sending if no specific bot is chosen |
| Enable Auto-Retry | Toggle automatic retry of failed messages on/off |
| Max Retry Count | Maximum number of retry attempts (default: 3) |
Note
You can also manually retry any failed message from the Telegram → Message Logs view by clicking the Retry button.
8. Message Logs & Audit Trail
Every Telegram message (sent, failed, or scheduled) is recorded in the Telegram → Message Logs view.
Log Fields
| Field | Description |
|---|---|
| Recipient | The partner the message was sent to |
| Chat ID | The Telegram chat ID used |
| Status | draft / sent / failed / scheduled |
| Message | Full message content |
| Bot | Which bot was used |
| Source Record | Link to the Odoo document that triggered the send | |
| Template | Template used (if any) |
| Sent At / Scheduled At | Timestamps |
| Error | Error message (for failed deliveries) |
| Retry Count | Number of retry attempts |
Chatter Audit Trail
After every send operation, a summary note is automatically posted on the chatter of the source document. The note includes:
- ✅ Recipients that received the message successfully
- ❌ Recipients that failed, with error details
9. Technical Architecture
End-to-End Flow
┌─────────────┐ ┌──────────────┐ ┌─────────────────┐
│ BotFather │────▶│ Odoo Bot │────▶│ setWebhook │
│ (get token) │ │ (verify) │ │ (register URL) │
└─────────────┘ └──────────────┘ └─────────────────┘
│
┌──────────────────────────────┘
▼
┌────────────────────────────────────┐
│ /telegram/webhook/<secret> │
│ (controller receives updates) │
└────────────────────────────────────┘
│
┌───────────┴───────────┐
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ /start command │ │ Other messages │
│ (map chat_id) │ │ (future use) │
└─────────────────┘ └──────────────────┘
┌─────────────────────────────────────────────────────┐
│ Send Wizard (from chatter) │
│ ┌─────────┐ ┌──────────┐ ┌─────────┐ │
│ │ Message │ │ Template │ │ Report │ │
│ │ (text) │ │ (Jinja2) │ │ (PDF) │ │
│ └────┬─────┘ └────┬─────┘ └────┬────┘ │
│ └──────────────┴─────────────┘ │
│ │ │
│ ┌───────┴───────┐ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Send Now │ │ Schedule │ │
│ │ (Telegram │ │ (cron job │ │
│ │ API call) │ │ picks up) │ │
│ └──────┬───────┘ └──────┬───────┘ │
│ └────────┬───────┘ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Message Log │ │
│ │ (audit trail) │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────┘
Models
| Model | Purpose |
|---|---|
| telegram.bot | Bot configuration (token, webhook, company) |
| telegram.model.config | Per-model access rules (reports, users, templates) |
| telegram.template | Message templates with Jinja2 and inline buttons |
| telegram.template.button | Inline keyboard buttons for templates |
| telegram.message.log | Message delivery log with status and retry tracking |
| telegram.send.wizard | Transient model for the send wizard |
API Endpoints
| Endpoint | Description |
|---|---|
| /telegram/webhook/<secret> | Receives incoming Telegram webhook updates |
Support
We provide free bug fixes and updates for this module.
If you encounter any issues or need assistance:
- Submit a support request through the Odoo Apps support page.
- Our team (the same developers who built the module) will respond promptly.
Important
Support is provided for clean Odoo installations. We cannot guarantee compatibility with heavily customized instances or conflicts with other third-party modules.
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module