Integrations

ServiceNow Google Chat Integration Guide

intermediateOAuth 2.0 Service Account with JSON Web Token (JWT)Google Chat

The ServiceNow Google Chat integration enables organizations to send automated notifications from ServiceNow to Google Chat spaces and receive user actions back into ServiceNow through bot interactions. This integration solves the critical business problem of keeping distributed teams informed about ServiceNow record changes, approvals, and incidents without requiring them to constantly monitor the ServiceNow interface. IT operations teams, service desk agents, and business stakeholders benefit from real-time notifications delivered directly to their collaborative workspaces. The integration supports bidirectional data flow where ServiceNow can send outbound notifications via webhooks or the Google Chat spoke, and inbound actions from Google Chat bots can create records, update fields, or trigger workflows in ServiceNow. The primary automation patterns include Business Rules triggering notifications and Scripted REST APIs handling inbound webhooks, with the core functionality residing in the Integration Hub and System Web Services modules.

Prerequisites

  • ServiceNow San Diego release or later for optimal Google Chat spoke support
  • Integration Hub Professional license or Integration Hub Starter with sufficient allocation
  • Google Workspace admin access to create and configure Chat apps
  • Google Cloud Project with Chat API enabled and service account credentials
  • sys_admin role in ServiceNow to configure Connection & Credential records
  • Google Chat space admin permissions to add webhooks and bots
  • IntegrationHub.admin role for configuring and testing spoke actions

Architecture Overview

The integration utilizes the official ServiceNow Google Chat spoke available in the Integration Hub, which provides pre-built actions for sending messages and managing conversations through Google Chat APIs. Authentication is established using OAuth 2.0 service account credentials stored in a Connection & Credential Alias record, with the private key securely encrypted in ServiceNow's credential store. Data flows bidirectionally with outbound notifications triggered by Business Rules or Flow Designer flows calling the Google Chat spoke actions, while inbound actions use Google Chat webhooks pointing to ServiceNow Scripted REST APIs. A MID Server is not required as the integration uses direct HTTPS communication between ServiceNow and Google's APIs, but consider MID Server usage if your instance has strict outbound connection policies. Rate limiting follows Google Chat API quotas of 10,000 requests per minute per project, and ServiceNow's Integration Hub action limits apply based on your license tier allocation.

Sourdough
Chrome Extension

Sourdough: ServiceNow Monitoring and Analytics

A Chrome extension for ServiceNow Admins and Developers with essential tools, analytics, graphs and monitoring features.

Instance HealthGraphs & ChartsAPI HealthDeveloper ToolsQuick SearchInstance Switcher
Add to Chrome

Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.

Overview
Tasks
CMDB
API
Metrics
Monitor
Internals
Instance:sourdoughdev·Version:Yokohama
Instance StateONLINE
System StatusFully Operational
Session Timeout90 minutes
Logged-In Sessions2 (20 active)
Build Nameyokohama-12-18-2024_p1
IP Address10.159.128.43
Instance HealthHealth Score: 90%
🔥 5dSourdough (Chrome Plugin)Dark Mode

Implementation Steps

1

Create Google Cloud Project and enable Google Chat API

Navigate to the Google Cloud Console and create a new project or select an existing one for the ServiceNow integration. Go to the API Library and search for 'Google Chat API', then click Enable to activate the service for your project. Navigate to IAM & Admin > Service Accounts and create a new service account with a descriptive name like 'servicenow-chat-integration'. Download the JSON credentials file containing the private key, client email, and project details. Ensure you save this file securely as it contains sensitive authentication information that cannot be regenerated with the same key.

2

Configure ServiceNow Connection and Credential records

Navigate to Connections & Credentials > Credentials in ServiceNow and create a new Basic Auth Credential record. Set the User name field to the client_email value from your Google service account JSON file, and paste the entire JSON file content into the Password field. Navigate to Connections & Credentials > Connection & Credential Aliases and create a new record with a name like 'Google_Chat_Connection'. Set the Connection URL to 'https://chat.googleapis.com' and select your previously created credential record. Test the connection to ensure the credential validation passes before proceeding to the next step.

3

Install and configure the Google Chat spoke in Integration Hub

Navigate to System Applications > All Available Applications > All and search for 'Google Chat' to locate the official ServiceNow Google Chat spoke. Click Install and wait for the spoke installation to complete, which typically takes 2-3 minutes. Go to Integration Hub > Connections and locate the Google Chat connection that was created during spoke installation. Edit the connection properties to reference your Connection & Credential Alias created in the previous step. Verify that the OAuth 2.0 settings are configured with the correct token URL 'https://oauth2.googleapis.com/token' and scope 'https://www.googleapis.com/auth/chat.bot'.

4

Create Google Chat app and configure webhook endpoints

Return to Google Cloud Console and navigate to APIs & Services > Credentials, then click Create Credentials > OAuth 2.0 Client ID for web application type. Configure the Chat API by going to the Google Chat API configuration page and creating a new Chat app with HTTP endpoints. Set the bot URL to point to your ServiceNow instance using the format 'https://your-instance.service-now.com/api/x_snc_google_chat/chat_webhook' (you'll create this endpoint in the next step). Configure the app permissions to allow it to receive messages and participate in spaces, then note the verification token provided by Google. Publish the Chat app to your Google Workspace domain so users can add it to their spaces.

5

Create Scripted REST API for inbound Google Chat webhooks

Navigate to System Web Services > Scripted REST APIs and create a new API with the name 'Google Chat Webhook Handler' and API ID 'google_chat'. Create a new resource under this API with the name 'Chat Webhook' and HTTP method 'POST', using the relative path 'chat_webhook'. In the resource script, implement webhook verification using Google's verification token and message processing logic to handle different event types like MESSAGE and ADDED_TO_SPACE. Add error handling and logging to track webhook processing success and failures for troubleshooting purposes.

ServiceNow Script
(function process(request, response) {
    var requestBody = request.body;
    var data = requestBody.data;
    
    // Verify webhook authenticity
    var expectedToken = gs.getProperty('google.chat.verification.token');
    if (data.token !== expectedToken) {
        response.setStatus(401);
        response.setBody(JSON.stringify({error: 'Unauthorized'}));
        return;
    }
    
    // Handle different event types
    if (data.type === 'MESSAGE') {
        var message = data.message;
        var space = data.space.name;
        
        // Process message and create ServiceNow record
        var gr = new GlideRecord('incident');
        gr.initialize();
        gr.short_description = 'Chat request: ' + message.text;
        gr.description = 'Created from Google Chat space: ' + space;
        gr.caller_id = getUserFromEmail(message.sender.email);
        var sysId = gr.insert();
        
        response.setStatus(200);
        response.setBody(JSON.stringify({
            text: 'Incident ' + gr.number + ' created successfully'
        }));
    }
    
    function getUserFromEmail(email) {
        var user = new GlideRecord('sys_user');
        user.addQuery('email', email);
        user.query();
        return user.next() ? user.getUniqueValue() : '';
    }
})(request, response);
6

Configure outbound notification Business Rules and Flow Designer flows

Navigate to System Definition > Business Rules and create a new Business Rule for the Incident table with appropriate When conditions (Insert, Update, etc.). In the Advanced tab, implement the logic to call the Google Chat spoke action using the Integration Hub APIs, passing the incident details as message content. Configure the space name or webhook URL where notifications should be sent, and include relevant incident information like number, priority, and assignment group. Alternatively, use Flow Designer by navigating to Process Automation > Flow Designer and create a flow that triggers on record changes and uses the Google Chat spoke action to send formatted messages with ServiceNow record links and status updates.

ServiceNow Script
(function executeRule(current, previous) {
    try {
        var chatSpoke = new sn_ih.IntegrationHub();
        var action = chatSpoke.getAction('Google Chat', 'Send Message');
        
        action.setParameter('space_name', 'spaces/AAAA_your_space_id');
        action.setParameter('message_text', 
            'Incident ' + current.number + ' has been updated\n' +
            'Priority: ' + current.priority.getDisplayValue() + '\n' +
            'State: ' + current.state.getDisplayValue() + '\n' +
            'Assigned to: ' + current.assigned_to.getDisplayValue() + '\n' +
            'Link: ' + gs.getProperty('glide.servlet.uri') + current.getLink()
        );
        
        var result = action.execute();
        if (result.getStatus() === 'success') {
            gs.info('Google Chat notification sent for incident ' + current.number);
        } else {
            gs.error('Failed to send Google Chat notification: ' + result.getErrorMessage());
        }
    } catch (e) {
        gs.error('Google Chat integration error: ' + e.message);
    }
})(current, previous);
7

Test the bidirectional integration functionality

Create a test incident record in ServiceNow to verify that outbound notifications are properly sent to the configured Google Chat space with correct formatting and links. Monitor the Integration Hub action logs under Integration Hub > Action Executions to confirm successful API calls and troubleshoot any failures. Test inbound functionality by adding your Google Chat bot to a test space and sending messages to verify that webhooks are received by your Scripted REST API endpoint. Check the System Logs > REST to view incoming webhook requests and verify that your processing logic correctly creates or updates ServiceNow records based on Chat interactions.

ServiceNow Script
// Test script for System Logs > Scripts - Background
var testIncident = new GlideRecord('incident');
testIncident.initialize();
testIncident.short_description = 'Google Chat Integration Test';
testIncident.urgency = 2;
testIncident.impact = 2;
var incidentId = testIncident.insert();

gs.info('Test incident created: ' + testIncident.number + ' with sys_id: ' + incidentId);

// Verify Google Chat spoke availability
var hub = new sn_ih.IntegrationHub();
var actions = hub.getAvailableActions('Google Chat');
gs.info('Available Google Chat actions: ' + JSON.stringify(actions));
8

Configure production security and monitoring

Navigate to System Properties > Basic Configuration and create custom system properties for Google Chat webhook verification tokens and space configurations to avoid hardcoding sensitive values in scripts. Set up proper ACL (Access Control List) rules for your Scripted REST API to restrict access and prevent unauthorized webhook calls. Configure Integration Hub connection monitoring by setting up automated health checks that periodically test the Google Chat API connectivity. Enable audit logging for Integration Hub actions and webhook processing by configuring appropriate log levels in System Logs > Log Reading, and consider setting up Event Management rules to alert administrators when integration failures occur consistently.

ServiceNow Script
// Health check script for scheduled job
var healthCheck = function() {
    try {
        var hub = new sn_ih.IntegrationHub();
        var testAction = hub.getAction('Google Chat', 'Send Message');
        
        // Test connection without sending actual message
        var connectionTest = testAction.testConnection();
        
        if (connectionTest.isSuccessful()) {
            gs.eventQueue('google.chat.health.success', null, 'Google Chat integration healthy');
            return 'SUCCESS';
        } else {
            gs.eventQueue('google.chat.health.failure', null, connectionTest.getErrorMessage());
            return 'FAILURE: ' + connectionTest.getErrorMessage();
        }
    } catch (e) {
        gs.eventQueue('google.chat.health.error', null, e.message);
        return 'ERROR: ' + e.message;
    }
};

gs.info('Google Chat health check result: ' + healthCheck());

Common Use Cases

Incident escalation notifications to on-call teams

When incidents reach Priority 1 or remain unassigned beyond defined SLA thresholds, automated notifications are sent to dedicated Google Chat spaces for on-call engineering teams. The integration sends formatted messages containing incident details, affected services, and direct links to ServiceNow records for immediate action. Business Rules trigger based on priority changes or assignment group modifications, ensuring that critical issues receive immediate visibility. This use case delivers significant business value by reducing mean time to response (MTTR) and ensuring that high-priority incidents don't get overlooked during busy periods or shift changes.

Change approval workflow notifications for CAB members

Change Advisory Board (CAB) members receive Google Chat notifications when change requests require their review and approval, with interactive buttons for approve/reject actions. The notifications include change details, risk assessment, implementation windows, and affected configuration items to enable informed decision-making without leaving the chat interface. When CAB members interact with approval buttons, the chat bot sends webhook responses back to ServiceNow to update the change request state and progress the workflow. This streamlines the change management process by reducing email overhead and providing a centralized communication channel for change discussions and decisions.

Service request status updates for end users

End users who submit service requests through ServiceNow receive automated status updates in Google Chat spaces when their requests progress through fulfillment stages. Notifications are triggered by workflow transitions and include request numbers, current status, estimated completion times, and any additional information or requirements from the fulfillment team. The integration personalizes messages by mentioning specific users and providing contextual information about their requests without exposing sensitive details to other space members. This improves user experience by providing proactive communication and reducing the volume of status inquiry calls to the service desk.

Problem management collaboration for technical teams

When new problems are identified or existing problems require additional investigation, notifications are sent to technical Google Chat spaces where subject matter experts collaborate on root cause analysis. The integration creates dedicated chat threads for each problem record and sends updates when related incidents are linked, workarounds are identified, or resolution progress is made. Team members can use chat commands to add comments to problem records, link additional incidents, or update problem states directly from the Google Chat interface. This facilitates real-time collaboration and knowledge sharing while maintaining a complete audit trail of problem resolution activities in ServiceNow.

Asset and configuration management alerts

IT operations teams receive Google Chat notifications when critical configuration items (CIs) undergo changes, when assets reach end-of-life dates, or when discovery processes identify configuration drift. The notifications include CI details, change history, relationships to business services, and recommended actions for maintaining configuration accuracy. Integration with ServiceNow's Discovery and Service Mapping provides automated alerts when infrastructure changes could impact service availability. This use case helps maintain accurate CMDB data and enables proactive infrastructure management by alerting teams to configuration changes that might require additional validation or remediation actions.

Troubleshooting

Google Chat spoke actions fail with 'Invalid JWT signature' authentication error

This typically indicates an issue with the service account credentials or clock synchronization. First, verify that the JSON service account key was correctly pasted into the ServiceNow credential record without extra spaces or line breaks. Check that the service account email in the credential matches exactly with the client_email field from the JSON file. Navigate to Integration Hub > Connections and test the Google Chat connection directly to isolate the authentication issue. If the problem persists, regenerate the service account key in Google Cloud Console and update the ServiceNow credential record with the new JSON content.

Webhook payloads received but Scripted REST API returns 500 Internal Server Error

Enable debug logging by setting the log level to 'Debug' for the 'rest' source in System Logs > Log Reading to capture detailed error information. Check the Application Logs for JavaScript errors in your webhook processing script, paying attention to null reference exceptions or malformed JSON parsing. Verify that all referenced ServiceNow tables and fields exist and are accessible with the current user context (typically the 'admin' user for REST endpoints). Add try-catch blocks around your webhook processing logic and implement proper error response handling to provide meaningful feedback to Google Chat about processing failures.

Messages sent to Google Chat but formatting appears broken or links are malformed

Google Chat requires specific markdown formatting and URL structures that differ from standard markdown. Verify that ServiceNow instance URLs are fully qualified with HTTPS protocol and that the gs.getProperty('glide.servlet.uri') returns the correct external URL accessible to Google Chat users. Review Google Chat's message formatting documentation and ensure that special characters are properly escaped in message content. Test message formatting using the Google Chat API Explorer before implementing in ServiceNow to validate that your message structure produces the expected visual output in Chat spaces.

Integration Hub actions show successful execution but no messages appear in Google Chat

Check that the space name or webhook URL parameter uses the correct format expected by Google Chat API, typically starting with 'spaces/' followed by the space identifier. Verify that the Google Chat bot has been properly added to the target spaces and has necessary permissions to post messages. Navigate to Integration Hub > Action Executions and examine the detailed response logs to confirm that Google API calls are returning successful HTTP 200 responses with valid message IDs. Test the space accessibility by manually posting a message through Google Chat web interface to ensure the space is active and the bot has appropriate permissions.

Rate limiting errors causing missed notifications during high-volume periods

Implement exponential backoff retry logic in your Business Rules or Flow Designer flows to handle temporary rate limiting from Google Chat API. Consider batching multiple ServiceNow record updates into summarized messages rather than sending individual notifications for each change. Monitor Integration Hub action execution patterns and configure appropriate delays between successive API calls using Flow Designer wait conditions or scheduled job processing. Review Google Chat API quotas in Google Cloud Console and consider requesting quota increases if your organization requires higher message throughput than the default limits allow.

Inbound chat commands create duplicate records or trigger multiple workflows

Implement idempotency checks in your Scripted REST API by storing and verifying Google Chat message IDs to prevent processing the same webhook payload multiple times. Add database locks or unique constraints when creating ServiceNow records from chat interactions to prevent race conditions during concurrent webhook processing. Configure appropriate business rule conditions to prevent cascading workflow triggers when records are created or modified through chat bot interactions. Log webhook processing attempts with unique identifiers and implement deduplication logic to handle webhook retries that Google Chat may send if initial processing appears to fail.

Pro Tips

  • Configure Integration Hub connection pooling and timeout settings optimally by setting connection timeout to 30 seconds and read timeout to 60 seconds for Google Chat spoke connections to handle varying API response times during peak usage periods. Monitor connection pool utilization in Integration Hub statistics and increase pool size if you observe connection queueing during high-volume notification periods.
  • Implement message templating using ServiceNow's Template Engine (sys_template) to standardize Google Chat message formatting across different notification types and ensure consistent branding and information presentation. Create reusable templates for common notification patterns like incident alerts, change approvals, and service request updates to maintain consistency and simplify maintenance.
  • Leverage Google Chat's thread and card features by implementing advanced message formatting in your ServiceNow integration code to create rich, interactive messages with buttons, images, and structured data that improve user engagement and provide contextual actions. Use cards for complex notifications and threads for follow-up messages to maintain conversation context.
  • Set up comprehensive monitoring and alerting for the integration by creating custom ServiceNow Event Management rules that trigger when Google Chat API calls consistently fail or when webhook processing errors exceed defined thresholds. Implement health check flows that periodically test the integration and automatically alert administrators to connectivity issues before they impact business operations.
  • Optimize performance for high-volume environments by implementing asynchronous message processing using ServiceNow's Scheduled Job framework to queue and batch Google Chat notifications rather than sending them synchronously in Business Rules, which can impact database transaction performance during peak system usage.
  • Enhance security by implementing IP address allowlisting for Google Chat webhook endpoints using ServiceNow's network access controls and by validating webhook signatures using Google's verification mechanisms to prevent unauthorized access to your Scripted REST APIs from external sources attempting to inject malicious data.

Known Limitations

  • Google Chat API enforces rate limits of 10,000 requests per minute per project, which may require message batching or queuing mechanisms for ServiceNow instances generating high notification volumes during incident storms or mass updates. Integration Hub license allocation also limits the number of spoke actions that can be executed per month, potentially impacting organizations with extensive notification requirements.
  • The Google Chat spoke does not support all advanced Chat API features like custom bot avatars, rich card interactions with complex layouts, or direct message capabilities outside of spaces, limiting the sophistication of user interactions compared to native Google Chat applications. Interactive features are limited to basic buttons and simple form inputs.
  • ServiceNow's Scripted REST APIs processing inbound Google Chat webhooks operate with limited execution time and memory constraints that may impact complex workflow processing or bulk data operations triggered by chat interactions. Long-running operations may timeout, requiring asynchronous processing patterns and additional complexity in implementation.
  • Message formatting and link rendering in Google Chat may not preserve all ServiceNow UI formatting or custom styling, and embedded links to ServiceNow records require users to have appropriate ServiceNow access permissions, potentially limiting the effectiveness of notifications for external stakeholders or users without ServiceNow licenses.
  • The integration requires ongoing maintenance of Google Cloud Project configurations, service account credentials, and API enablement status, creating additional administrative overhead and potential points of failure outside of ServiceNow's direct control that could impact integration reliability during Google platform changes or policy updates.

Frequently Asked Questions

Can the Google Chat integration work with ServiceNow instances behind firewalls or in private networks?

Yes, but it requires careful network configuration since Google Chat needs to send webhooks to your ServiceNow instance and your instance needs outbound access to Google's APIs. For inbound webhooks, you'll need to expose your ServiceNow Scripted REST API endpoints to the internet or configure a reverse proxy that Google Chat can reach. Outbound notifications work through standard HTTPS connections to Google's API endpoints, so ensure your firewall allows connections to chat.googleapis.com and oauth2.googleapis.com. Consider using ServiceNow's MID Server with proxy capabilities if your security policies restrict direct internet access from the ServiceNow instance.

How do I handle user authentication and permissions when processing inbound Google Chat commands?

Google Chat webhooks include the sender's email address in the payload, which you can use to identify and authenticate ServiceNow users in your Scripted REST API processing logic. Query the sys_user table using the email address to find the corresponding ServiceNow user and check their roles and permissions before processing commands or creating records. Implement proper access controls by validating that users have appropriate permissions for the actions they're requesting through chat commands. For users without ServiceNow accounts, you can either reject their commands with helpful error messages or implement a user provisioning workflow that creates basic ServiceNow records for authenticated Google Workspace users.

What happens if Google Chat or ServiceNow experiences downtime during the integration?

During Google Chat downtime, outbound ServiceNow notifications will fail, and you should implement retry logic with exponential backoff in your Business Rules or flows to handle temporary service interruptions. The Integration Hub spoke will return error responses that you can catch and log for later processing or manual review. During ServiceNow downtime, Google Chat webhooks will receive HTTP error responses and Google typically retries webhook delivery for several hours with increasing intervals. Design your webhook processing to be idempotent so that retried messages don't create duplicate records or trigger duplicate workflows when ServiceNow comes back online.

Can I customize the Google Chat bot appearance and responses beyond the standard spoke functionality?

Yes, you have significant control over bot behavior through your Google Cloud Console Chat app configuration and ServiceNow webhook processing logic. Configure custom bot names, descriptions, and avatar images in the Google Chat API console to match your organization's branding. In your ServiceNow Scripted REST API, implement sophisticated response logic that can handle natural language processing, command parsing, and contextual responses based on conversation history or user roles. You can create rich interactive messages with buttons, cards, and formatted content that goes beyond simple text responses, though you're limited by Google Chat's supported message formats and interaction capabilities.

How do I manage different Google Chat spaces for different ServiceNow applications or departments?

Implement a configuration table in ServiceNow that maps different record types, assignment groups, or business units to specific Google Chat space identifiers, allowing dynamic routing of notifications based on context. Create system properties or custom configuration records that store space mappings like 'hr_requests' mapping to 'spaces/HR_SPACE_ID' and 'network_incidents' mapping to 'spaces/NOC_SPACE_ID'. In your Business Rules and Flow Designer flows, query these configuration mappings to determine the appropriate destination space based on record attributes like assignment group, category, or custom fields. This approach allows you to maintain centralized configuration while supporting complex organizational notification routing requirements without hardcoding space identifiers in multiple places.

What are the data residency and compliance considerations for Google Chat integration?

Google Chat data residency depends on your Google Workspace organization's configured data location settings, which may impact compliance with regulations like GDPR, HIPAA, or SOX that govern your ServiceNow data. Review Google's compliance certifications and data processing agreements to ensure they meet your organization's requirements for handling ServiceNow data in chat messages. Consider implementing data sanitization in your integration logic to remove or mask sensitive information like social security numbers, financial data, or personal health information before sending notifications to Google Chat. Maintain audit logs of all data transmitted between ServiceNow and Google Chat to support compliance reporting and incident response requirements, and ensure that your Google Workspace retention and legal hold policies align with your ServiceNow data governance requirements.

How can I implement advanced workflow automation triggered by Google Chat interactions?

Design your Scripted REST API webhook handlers to parse natural language commands and trigger ServiceNow workflows, approval processes, or Integration Hub flows based on chat interactions. Implement command parsing logic that recognizes patterns like 'approve change CHG001234' or 'assign incident INC001234 to john.doe' and translates these into appropriate ServiceNow record updates and workflow triggers. Use ServiceNow's Flow Designer to create sophisticated automation workflows that can be initiated by webhook processing and include human approval steps, external system integrations, and complex business logic. Consider implementing conversation state management by storing chat context in custom ServiceNow tables to enable multi-step workflows where users can provide additional information or confirmations through subsequent chat messages, creating seamless conversational interfaces for complex ServiceNow processes.

Test Your Knowledge

Quick 3-question quiz — see how your ServiceNow skills stack up.

Question 1 of 3Performance

A list view on a table with millions of records is slow. Best fix?

Select an answer to continue