Skip to content

[17.0][MIG] mail_gateway_telegram: Migration to v17 #1615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 17 commits into
base: 17.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions mail_gateway_telegram/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
=====================
Mail Telegram Gateway
=====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a25c75cfe860d7580c1121551e156a8f6126aeda68f63f3d5d16c8b48fb9f544
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/17.0/mail_gateway_telegram
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_gateway_telegram
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to respond telegram chats as a telegram bot.

This way, a group of users can respond customers or any other set of
partners in an integrated way.

It is not intended to be integrated on default chatter as users don't
need to review again when one has responded.

**Table of contents**

.. contents::
:local:

Configuration
=============

Create the bot
--------------

1. Create a Bot on telegram https://core.telegram.org/bots
2. Create a broker following the examples on
https://github.com/tegin/telegram-broker with the TOKEN provided

Configure Odoo
--------------

1. Access on debug mode
2. Access Settings > Technical Settings > Email > Mail Gateway.
3. Access Telegram and start a converstation with BotFather.
4. Create a bot using the command /newbot. The system will ask for a bot
name. Remember that it needs to end with the word bot.
5. Copy the token to access the HTTP API to the token field.
6. Define Webhook key an webhook secret of your choice in its
corresponding field, in order to secure the connection.
7. Press save button and the integrate webhook smart button will appear.
8. Press the Integrate webhook button.
9. If you want to add an extra layer of security, you can check Has New
Channel Security and define a Telegram security key. New chats will
be created only with the command /start SECURITY_KEY.

Limitations
-----------

The Webhook functionality can only be used if your system is accessible
from website. On local installations it might be problematic as Telegram
will not be able to contact your system. In that case, you might need to
create a telegram bot that will send data to you on an external process
with the following code.

.. code:: python

from telegram.ext import Filters, MessageHandler, Updater
import requests
dp = Updater(YOUR_TOKEN)

def message_callback(update, _context):
requests.post(YOUR_CONTROLLER, json=update.to_dict())


dp.dispatcher.add_handler(MessageHandler(Filters.all, message_callback))
dp.start_polling()
dp.idle()

Usage
=====

1. Access Gateway
2. Wait until someone starts a conversation with your bot.
3. Now you will be able to respond and receive messages to this person.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_gateway_telegram%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Creu Blanca
* Dixmit

Contributors
------------

- Enric Tobella <[email protected]>
- Olga Marco <[email protected]>

Other credits
-------------

This work has been funded by AEOdoo (Asociación Española de Odoo -
https://www.aeodoo.org)

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/mail_gateway_telegram>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions mail_gateway_telegram/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import models

# from . import services
21 changes: 21 additions & 0 deletions mail_gateway_telegram/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Dixmit
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Mail Telegram Gateway",
"summary": """
Set a gateway for telegram""",
"version": "17.0.1.0.1",
"license": "AGPL-3",
"author": "Creu Blanca,Dixmit,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"depends": ["mail_gateway"],
"data": ["views/mail_gateway.xml"],
"external_dependencies": {"python": ["python-telegram-bot", "lottie", "cairosvg"]},
"assets": {
"mail.assets_messaging": [
"mail_gateway_telegram/static/src/models/**/*.js",
"mail_gateway_telegram/static/src/components/**/*.xml",
],
},
}
121 changes: 121 additions & 0 deletions mail_gateway_telegram/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_gateway_telegram
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-11-14 11:06+0000\n"
"Last-Translator: PabloMartin32 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid "Access Telegram and start a converstation with"
msgstr "Accede a Telegram y empieza la conversación"

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid "BotFather"
msgstr "Bot Father"

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid ""
"Copy the <b>token given by BotFather to access the HTTP API</b> to the token"
" field."
msgstr ""
"Copia el <b>token enviado por Bot Father para acceder a la API HTTPS</b>en "
"el campo del token."

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid ""
"Create a bot using the command /newbot. The system will ask for a bot name. "
"Remember that it needs to end with the word bot."
msgstr ""
"Crea un bot utilizando el comando /newbot. El sistema te preguntará por un "
"nombre para el bot. Recueda que debe terminar con la palabra bot."

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid ""
"Define a Webhook key and a webhook secret of your choice in its "
"corresponding field, in order to secure the connection."
msgstr ""
"Escriba un Webhook key y un webhook secret a tu elección en el campo "
"correspondiente, para estrabler una conexión segura."

#. module: mail_gateway_telegram
#: model:ir.model,name:mail_gateway_telegram.model_mail_channel
msgid "Discussion Channel"
msgstr "Canal de conversaciones"

#. module: mail_gateway_telegram
#: model:ir.model.fields,field_description:mail_gateway_telegram.field_mail_gateway__gateway_type
msgid "Gateway Type"
msgstr "Tipo de gateway"

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid ""
"If you want to add an extra layer of security, you can check <b>Has New Channel Security</b>\n"
" and define a <b>Telegram security key</b>.\n"
" New chats will be created only with the command <b>/start SECURITY_KEY</b>."
msgstr ""
"Si quieres una capa extra de seguridad, debes marcar <b>nueva seguridad en "
"el canal</b>\n"
" y ponga <b>una clave de "
"seguridad de Telegram</b>.\n"
" Los nuevos chats solo "
"se crearán con el comando <b>/start SECURITY_KEY</b>."

#. module: mail_gateway_telegram
#: model:ir.model,name:mail_gateway_telegram.model_mail_gateway
msgid "Mail Gateway"
msgstr "Gateway de correo"

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid "Press the Integrate webhook button."
msgstr "Pulsa el botón de integrar con webhook."

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid ""
"Press the save button and the integrate webhook smart button will appear."
msgstr "Pulse en guardar y aparecerá el botón de integrar con webhook."

#. module: mail_gateway_telegram
#: model:ir.model.fields.selection,name:mail_gateway_telegram.selection__mail_gateway__gateway_type__telegram
msgid "Telegram"
msgstr "Telegram"

#. module: mail_gateway_telegram
#: model:ir.model,name:mail_gateway_telegram.model_mail_gateway_telegram
msgid "Telegram Gateway services"
msgstr "Servicios de Gateway de Telegram"

#. module: mail_gateway_telegram
#: model:ir.model.fields,field_description:mail_gateway_telegram.field_mail_gateway__telegram_security_key
msgid "Telegram Security Key"
msgstr "Clave de seguridad de Telegram"

#. module: mail_gateway_telegram
#: model_terms:ir.ui.view,arch_db:mail_gateway_telegram.mail_gateway_form_view
msgid "Telegram configuration"
msgstr "Configuración de Telegram"

#. module: mail_gateway_telegram
#. odoo-python
#: code:addons/mail_gateway_telegram/models/mail_gateway_telegram.py:0
#, python-format
msgid "Unable to send the telegram message"
msgstr "No es posible enviar un mensaje en telegram"
Loading
Loading