Skip to Content
Menu

Google Chat Notification

by
Odoo
v 15.0 Third Party 12
Download for v 15.0 Deploy on Odoo.sh
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 86
Technical Name google_chat
LicenseAGPL-3
Websitehttps://mhdsyarif.com
Versions 15.0 16.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 86
Technical Name google_chat
LicenseAGPL-3
Websitehttps://mhdsyarif.com
Versions 15.0 16.0

Google Chat Incoming Webhooks

Send Messages Using Incoming Webhooks

Documentation

Refer to the official documentation: https://developers.google.com/chat/how-tos/webhooks.

Setup & Usage

1. Assign Role Access

Role AccessGoogle Chat

2. Configure Google Chat Settings

Navigate to:

Settings → Google Chat

Example Configuration
  • Name: Order Notifications
  • Space Code: AAAAXXXX
  • Environment: STAGING / PRODUCTION
  • Space Key: AIzaSyZtE6vySjXXXXXXX
  • Space Token: BQvpPC3M5qppMyDcsiXXXXXX
  • Mention Users: <users/123456789012345678901>

Example API Call (cURL)

curl -H 'Content-Type: application/json' -X POST \
"https://chat.googleapis.com/v1/spaces/AAAAXXXX/messages?key=AIzaSyZtE6vySjXXXXXXX&token=UBQJ-BQvpPC3M5qppMyDcsiXXXXXX" \
--data '{"text": "hi there"}'

Odoo Integration Example

"""
Example: Sending a webhook message to Google Chat when a sales order is confirmed.
"""
import logging
from odoo import models, _

_logger = logging.getLogger(__name__)

class SalesOrder(models.Model):
    _inherit = "sale.order"

    def action_confirm(self):
        result = super(SalesOrder, self).action_confirm()
        try:
            google_chat = self.env["google.chat"].search([( "name", "=", "Order Notifications")], limit=1)
            if google_chat:
                message = f"Sale Order {self.name} has been confirmed."
                google_chat.send_message(message)
            else:
                _logger.warning(_("Google Chat configuration not found."))
        except Exception as e:
            _logger.warning(_("Failed to send message to Google Chat: %s"), str(e))

        return result

Issue

https://github.com/mhdsyarif/odoo-addons/issues

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.