Skip to content

Google Chat Integration

Send automated notifications to Google Chat when business events occur in Odoo.

Overview

The JDX Google Chat Integration module (jdx_google_chat) provides real-time notifications to Google Chat spaces when key business events occur. Each company can configure their own webhook and notification preferences.

Key Features

  • Per-company configuration - Each company has independent webhook and settings
  • Message queue with retry - Failed messages retry automatically with exponential backoff
  • Customizable templates - Configure message format for each event type
  • Event-driven notifications for:
  • FSM Order stage changes
  • Sale Order confirmations
  • Invoice postings
  • Purchase Order confirmations
  • Test webhook functionality - Verify connectivity before going live
  • Message history - Track all sent and failed messages

Installation

Prerequisites

Required modules:

  • base
  • mail
  • sale
  • account
  • purchase

Optional module:

  • industry_fsm - Required only for FSM stage change notifications

Install Steps

  1. Update module list: Apps > Update Apps List
  2. Search for "JDX Google Chat"
  3. Click Install
# Or via command line
docker compose exec odoo odoo -i jdx_google_chat --stop-after-init -d YOUR_DATABASE

Configuration

Step 1: Get Google Chat Webhook URL

  1. Open Google Chat
  2. Go to the Space where you want notifications
  3. Click Space name > Apps & integrations > Webhooks
  4. Click Add webhook
  5. Enter a name (e.g., "Odoo Notifications")
  6. Copy the webhook URL

Keep Webhook Secret

The webhook URL contains a secret key. Do not share it publicly.

Step 2: Configure in Odoo

  1. Go to Google Chat > Configuration
  2. Click Create
  3. Select your Company
  4. Paste the Webhook URL
  5. Enable desired notifications
  6. Click Save

Step 3: Test Connection

  1. Open your configuration
  2. Click Test Webhook button
  3. Enter a test message
  4. Click Send Test Message
  5. Verify message appears in Google Chat

Notification Events

FSM Stage Changes

Requires industry_fsm

This notification type is only available when the industry_fsm module is installed.

Triggered when an FSM order moves to a new stage.

Default template:

*FSM Order Update*
Order: {name}
Customer: {partner_name}
Stage: {stage_name}
Scheduled: {scheduled_date}
Assigned: {user_name}

Use case: Track field service progress in real-time.

Sale Order Confirmed

Triggered when a sale order is confirmed.

Default template:

*Sale Order Confirmed*
Order: {name}
Customer: {partner_name}
Amount: {amount_total}
Salesperson: {user_name}

Use case: Alert sales team about new confirmed orders.

Invoice Posted

Triggered when an invoice is posted (validated).

Default template:

*Invoice Posted*
Invoice: {name}
Customer: {partner_name}
Amount: {amount_total}
Due Date: {invoice_date_due}

Use case: Notify finance team about new invoices.

Purchase Order Confirmed

Triggered when a purchase order is confirmed.

Default template:

*Purchase Order Confirmed*
Order: {name}
Vendor: {partner_name}
Amount: {amount_total}
Expected: {date_planned}

Use case: Alert procurement about confirmed purchases.


Template Placeholders

Customize message templates using these placeholders:

Placeholder Description Example
{name} Record name/reference SO001, FSM/001
{partner_name} Customer/vendor name ABC Company
{user_name} Assigned user John Smith
{stage_name} Current stage In Progress
{amount_total} Total amount 1,500.00
{scheduled_date} Scheduled date 2025-01-15 09:00
{date_planned} Planned date 2025-01-20
{invoice_date_due} Invoice due date 2025-02-15
{state} Record state confirmed

Custom Template Example

*New Sale Order*
Reference: {name}
Client: {partner_name}
Value: ${amount_total}
Rep: {user_name}

Message Queue

How It Works

  1. When an event triggers, a message is created in the queue
  2. The message is sent immediately
  3. If sending fails, it's scheduled for retry
  4. After 3 failures, the message is marked as "Failed"

Retry Schedule

Attempt Delay Cumulative
1st retry 5 minutes 5 min
2nd retry 15 minutes 20 min
3rd retry 45 minutes 65 min
Mark failed - After 3 attempts

Viewing Messages

  1. Go to Google Chat > Message Queue
  2. View all messages with status
  3. Filter by: Pending, Sent, Failed

Manual Actions

Action Description
Retry Resend a failed message
Cancel Cancel a pending message
Send Now Immediately send a pending message

Cron Jobs

The module includes two scheduled tasks:

Process Message Queue

  • Frequency: Every 5 minutes
  • Function: Sends pending messages that are due
  • Batch size: 50 messages per run

Cleanup Old Messages

  • Frequency: Daily
  • Function: Deletes sent messages older than 30 days
  • Purpose: Prevent database bloat

Security

Access Groups

Group Permissions
Google Chat Manager Full access: create, edit, delete configurations and messages
Google Chat User Read-only access to view configurations and messages

Multi-Company

  • Each company can only see their own configuration
  • Messages are company-specific
  • Record rules enforce data isolation

Troubleshooting

Messages Not Sending

  1. Check configuration is active
  2. Go to Configuration
  3. Verify "Active" toggle is enabled

  4. Check webhook URL

  5. Must start with https://chat.googleapis.com/
  6. Test using the Test Webhook button

  7. Check cron job

  8. Go to Settings > Technical > Scheduled Actions
  9. Find "Google Chat: Process Message Queue"
  10. Verify it's active and running

Messages Failing

  1. View error message
  2. Go to Message Queue
  3. Open the failed message
  4. Check "Error Message" field

  5. Common errors:

Error Solution
HTTP 400 Invalid webhook URL or payload
HTTP 401 Webhook URL expired or invalid
HTTP 404 Space deleted or webhook removed
Request timeout Network issue, will auto-retry
Connection error Firewall blocking, check network
  1. Retry manually
  2. Open failed message
  3. Click Retry button

Notifications Not Triggering

  1. Check notification setting
  2. Open Configuration
  3. Verify the event type is enabled (e.g., "FSM Stage Changes")

  4. Check company match

  5. The record's company must match a configuration's company

  6. Check Odoo logs

    docker compose logs odoo | grep -i "google.chat"
    


API Reference

Models

google.chat.config

Per-company configuration for Google Chat integration.

Field Type Description
company_id Many2one Company this config belongs to
webhook_url Char Google Chat webhook URL
active Boolean Enable/disable notifications
notify_fsm_stage_change Boolean Notify on FSM stage changes
notify_sale_confirmed Boolean Notify on sale confirmation
notify_invoice_posted Boolean Notify on invoice posting
notify_purchase_confirmed Boolean Notify on PO confirmation
*_template Text Message templates for each event

google.chat.message

Message queue for outgoing notifications.

Field Type Description
reference Char Unique message reference (auto-generated)
company_id Many2one Company this message belongs to
message_text Text Message content
state Selection pending / sent / failed
retry_count Integer Number of retry attempts
error_message Text Last error if failed
source_model Char Model that triggered the message
source_id Integer Record ID that triggered the message

Methods

google.chat.config.send_message(text, card=None)

Send a message to Google Chat.

config = self.env['google.chat.config'].get_config(company_id)
config.send_message("Hello from Odoo!")

google.chat.config.get_config(company_id=None)

Get the active configuration for a company.

config = self.env['google.chat.config'].get_config()
if config:
    # Configuration exists and is active
    pass

Version History

Version Date Changes
15.0.1.0.0 2025-01 Initial release