| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 382 |
| Technical Name |
sm_telegram_base |
| License | OPL-1 |
Telegram Connector - Base
Connect your Odoo instance to Telegram: bot management, partner mapping & secure webhook
Module Video Overview
Features
1 Create & manage botsCreate 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 One-click verify & webhook
Click Verify Bot to validate your token via Telegram's |
3 Auto contact mapping
When a Telegram user sends |
|
|
4 Partner Telegram fieldsTwo new fields added to every contact: Telegram Username (set manually) and Telegram Chat ID (auto-filled via /start webhook). Ready for any module that needs to send Telegram messages. |
And more...
Multi-CompanyEach company gets its own bot. The system auto-selects the correct verified bot for the current company. |
Secure WebhookAuto-generated secret token for webhook validation. Only verified requests from Telegram are processed. |
Global SettingsConfigure the default bot from Odoo’s Settings screen. Used by all add-on modules automatically. |
API HelpersBuilt-in methods: |
Foundation ModuleThis is the base for the entire Telegram ecosystem. Install add-on modules for chatter sending, templates, scheduling & more. |
Secure by DefaultBot tokens stored securely. Webhook URLs validated with secret tokens. Regular users get read-only access; admins get full control. |
Telegram Module Ecosystem
| Telegram Connector - Base (this module) | ||
|
Telegram - Send Messages Chatter button, send wizard, message logs, bulk send |
||
|
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 Connector – Base
Table of Contents
Overview
Telegram Connector - Base is the foundation module for the Odoo 18 Telegram ecosystem. It provides bot management, partner Telegram fields, a secure webhook endpoint, and global settings. Install this module first, then add the companion modules (Send Messages, Templates, Scheduler) for a complete integration.
Prerequisites
Before installing, make sure you have:
- A Telegram Bot created via @BotFather
- A publicly reachable URL for your Odoo instance (required for webhook)
- A valid SSL certificate (Telegram requires HTTPS for webhooks)
Installation
- Place the sm_telegram_base folder in your Odoo addons path.
- Update the module list:
- Go to Apps → Update Apps List → click Update.
- Search for Telegram Connector – Base and click Install.
Configuration
Creating a Telegram Bot
- Open Telegram and search for @BotFather.
- Send /newbot and follow the prompts to choose a name and username.
- Copy the HTTP API Token provided by BotFather.
Adding the Bot in Odoo
- Navigate to Telegram → Bots.
- Click New.
- Fill in:
- Name: A friendly label (e.g. "Production Bot")
- Token: The token from BotFather
- Company: The company this bot belongs to (multi-company support)
- Click Verify Bot. Odoo will call Telegram's getMe API. On success the bot's username is auto-filled and the state changes to Verified.
Setting Up the Webhook
- On the same bot form, click Setup Webhook.
- Odoo registers the webhook URL: https://<your-domain>/telegram/webhook/<bot_id>
- A secret token is auto-generated and stored on the bot record.
- Telegram will now push all incoming messages to your Odoo instance.
To remove the webhook, click Remove Webhook.
Global Settings
Go to Settings → Telegram section:
- Default Bot: Select the bot to use across the system. Used as the fallback when no specific bot is configured elsewhere.
Partner / Contact Fields
Two fields are added to res.partner:
Auto Contact Mapping via /start
When a Telegram user sends /start to your bot:
- The webhook receives the message.
- Odoo searches for a partner whose telegram_username matches the sender's Telegram username.
- If found, the partner's telegram_chat_id is automatically filled in.
This means contacts only need to have their Telegram username entered in Odoo. After they send /start, the chat ID is populated automatically — no manual copy-pasting required.
Technical Architecture
Models
| Model | Table | Description |
|---|---|---|
| sm.telegram.bot | sm_telegram_bot | Bot records & API methods |
| res.partner (inherit) | res_partner | Telegram fields on contacts |
| res.config.settings (inherit) | (transient) | Default bot global setting |
Key Methods on sm.telegram.bot
- action_verify_bot() – Calls getMe, stores bot_username, sets state.
- action_setup_webhook() – Calls setWebhook with auto-generated secret.
- action_remove_webhook() – Calls deleteWebhook.
- send_message(chat_id, text, **kwargs) – Sends a text message.
- send_document(chat_id, document, **kwargs) – Sends a file/document.
- send_photo(chat_id, photo, **kwargs) – Sends a photo.
- _telegram_request(method, **params) – Low-level API wrapper.
- _process_webhook_update(data) – Handles incoming webhook payloads.
- _get_default_bot() – Returns the verified bot for the current company.
Webhook Controller
Route: /telegram/webhook/<int:bot_id>
- Method: POST
- Auth: none (public endpoint)
- Validates the X-Telegram-Bot-Api-Secret-Token header against the stored webhook_secret.
- Delegates processing to sm.telegram.bot._process_webhook_update().
Security
- Access rights: defined in security/ir.model.access.csv.
- Admin users have full CRUD on sm.telegram.bot.
- Regular users can read bot records but cannot modify them.
- Bot tokens are stored in standard Odoo fields — not exposed in views for non-admin users.
- Webhook secret token ensures only Telegram can call the endpoint.
Add-on Modules
This base module is designed to be extended. The ecosystem includes:
- Telegram – Send Messages (sm_telegram_core) - Chatter "Send Telegram" button - Send wizard with text, photo, document support - Model configuration (which models can send) - Message logs with delivery status
- Telegram Templates (sm_telegram_template) - Jinja2 message templates - Inline keyboard buttons - Live preview & test render
- Telegram Scheduler (sm_telegram_scheduler) - Send later (scheduled messages) - Auto-retry failed messages via cron - Configurable retry settings
Support
For bug reports or feature requests, please use the Odoo Apps support page or contact us through the store listing. We provide free bug-fix support for all our 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