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:
basemailsaleaccountpurchase
Optional module:
industry_fsm- Required only for FSM stage change notifications
Install Steps¶
- Update module list: Apps > Update Apps List
- Search for "JDX Google Chat"
- 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¶
- Open Google Chat
- Go to the Space where you want notifications
- Click Space name > Apps & integrations > Webhooks
- Click Add webhook
- Enter a name (e.g., "Odoo Notifications")
- Copy the webhook URL
Keep Webhook Secret
The webhook URL contains a secret key. Do not share it publicly.
Step 2: Configure in Odoo¶
- Go to Google Chat > Configuration
- Click Create
- Select your Company
- Paste the Webhook URL
- Enable desired notifications
- Click Save
Step 3: Test Connection¶
- Open your configuration
- Click Test Webhook button
- Enter a test message
- Click Send Test Message
- 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¶
Message Queue¶
How It Works¶
- When an event triggers, a message is created in the queue
- The message is sent immediately
- If sending fails, it's scheduled for retry
- 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¶
- Go to Google Chat > Message Queue
- View all messages with status
- 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¶
- Check configuration is active
- Go to Configuration
-
Verify "Active" toggle is enabled
-
Check webhook URL
- Must start with
https://chat.googleapis.com/ -
Test using the Test Webhook button
-
Check cron job
- Go to Settings > Technical > Scheduled Actions
- Find "Google Chat: Process Message Queue"
- Verify it's active and running
Messages Failing¶
- View error message
- Go to Message Queue
- Open the failed message
-
Check "Error Message" field
-
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 |
- Retry manually
- Open failed message
- Click Retry button
Notifications Not Triggering¶
- Check notification setting
- Open Configuration
-
Verify the event type is enabled (e.g., "FSM Stage Changes")
-
Check company match
-
The record's company must match a configuration's company
-
Check Odoo logs
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 |