TechBuzzPro

ServiceNow Slack Integration: A Step-by-Step Guide

· 6 min read · Apps & Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can integrate Slack with ServiceNow. This integration allows you to receive ServiceNow notifications, create incidents, and perform other actions directly from Slack, improving collaboration and response times. To begin, you'll need a ServiceNow instance with appropriate administrative permissions and a Slack workspace where you have permissions to install apps and manage integrations. The basic process involves configuring a ServiceNow connection to Slack, then creating Slack actions that trigger ServiceNow workflows.

What You'll Need

  • ServiceNow Instance: You need access to a ServiceNow instance with the "admin" role or a role with equivalent permissions.
  • Slack Workspace: You'll require a Slack workspace where you have permissions to install apps and configure integrations.
  • Slack App: You'll create a Slack app (or use an existing one) to manage the integration.
  • ServiceNow IntegrationHub: ServiceNow's IntegrationHub is the preferred method for this integration. Ensure it's enabled in your ServiceNow instance.
  • Network Connectivity: Both ServiceNow and Slack need to be accessible over the network.

Step-by-Step

  1. Create a Slack App: In your Slack workspace, go to https://api.slack.com/apps and click "Create New App." Choose "From scratch." Give your app a name (e.g., "ServiceNow Integration") and select the workspace you want to integrate with.
  2. Configure Slack App Permissions (Scopes): Within your Slack app settings, navigate to "OAuth & Permissions." Under "Scopes," add the following Bot Token Scopes: chat:write, chat:write.public, commands, incoming-webhook, and users:read. These scopes allow the app to send messages, create commands, and access user information.
  3. Install the Slack App to Your Workspace: Still in "OAuth & Permissions," click "Install to Workspace." Review the requested permissions and click "Allow." This will generate a Bot User OAuth Token; copy this token – you'll need it in ServiceNow.
  4. Create an Incoming Webhook (Optional but Recommended): In your Slack app, go to "Features" > "Incoming Webhooks." Activate "Incoming Webhooks" and choose a channel where ServiceNow notifications will be posted. Copy the Webhook URL – this is how ServiceNow will send messages directly to Slack.
  5. In ServiceNow, Enable IntegrationHub: Navigate to "System Applications" > "Application Navigator." Search for and install "IntegrationHub."
  6. Create a ServiceNow Connection to Slack: In IntegrationHub, go to "Connections" > "New." Select "Slack" as the connection type. Provide a descriptive name (e.g., "Slack Connection").
  7. Configure the Slack Connection: When creating the connection, you'll be prompted for the Slack Bot User OAuth Token you obtained in Step 3. Enter the token and click "Test Connection" to verify the connection is working.
  8. Create a ServiceNow Flow (Recommended): While you can directly use ServiceNow's "Send to Slack" action, creating a Flow provides more flexibility and control. Go to "Flow Designer" > "New Flow." Choose a trigger (e.g., "Record Created," "Record Updated") for the events you want to notify Slack about.
  9. Add Actions to the Flow: Within the Flow, add the "Send to Slack" action. Configure the action to use the Slack connection you created in Step 6. You can customize the message format using Flow variables to include relevant information from the ServiceNow record. For example, you can include the incident number, description, and assigned group.
  10. Test the Flow: Run the Flow manually or trigger it by creating or updating a record that matches the Flow's trigger conditions. Verify that a message is sent to the designated Slack channel.
  11. Create Slack Commands (Optional): To allow users to create ServiceNow incidents directly from Slack, you can create Slack commands. In your Slack app, go to "Features" > "Slash Commands." Create a new command (e.g., `/incident`). Specify the command name, request URL (this will be a ServiceNow REST endpoint – you’ll need to create this), and short description.
  12. Develop a ServiceNow REST API Endpoint: You'll need to create a ServiceNow REST API endpoint that handles the Slack command requests. This endpoint should parse the command parameters, validate the data, and create a new incident in ServiceNow.
  13. Configure the Slack Command Request URL: In the Slack command configuration, provide the URL of the ServiceNow REST API endpoint you created.

Common Mistakes

  • Incorrect OAuth Token: Double-check that you've copied the correct Bot User OAuth Token from Slack. A common error is copying the wrong type of token.
  • Insufficient Slack Scopes: Ensure your Slack app has all the necessary scopes (chat:write, commands, incoming-webhook, etc.). Missing scopes will prevent the integration from working correctly.
  • Firewall Issues: Verify that your ServiceNow instance can communicate with Slack's servers. Firewalls or proxies may be blocking the connection.
  • Flow Trigger Issues: Make sure the Flow trigger conditions are correctly defined to match the events you want to monitor.
  • Missing Webhook URL: If you're using an Incoming Webhook, double-check that you've configured the webhook URL correctly in ServiceNow.
  • Incorrect REST API Endpoint: When using Slack commands, ensure that the ServiceNow REST API endpoint is correctly configured and handles the Slack requests properly.

Tips

  • Use Flow Variables: Leverage Flow variables to dynamically include relevant information from ServiceNow records in your Slack messages.
  • Customize Message Formatting: Use Markdown or other formatting options to make your Slack messages more readable and informative.
  • Implement Error Handling: Add error handling to your ServiceNow Flows and REST API endpoints to gracefully handle failures and provide informative error messages.
  • Test Thoroughly: Test the integration thoroughly with different scenarios and user roles to ensure it functions as expected.
  • Consider Security: Secure your ServiceNow REST API endpoints with appropriate authentication and authorization mechanisms.
  • Monitor the Integration: Regularly monitor the integration for errors and performance issues.

Troubleshooting

  • Connection Issues: If the ServiceNow connection to Slack fails, verify the OAuth token, check your network connectivity, and ensure that Slack's servers are accessible.
  • Message Delivery Failures: If messages are not being delivered to Slack, check the Slack Incoming Webhook URL, verify the Flow configuration, and review the ServiceNow logs for errors.
  • Slack Command Errors: If Slack commands are not working, verify the command configuration, check the ServiceNow REST API endpoint, and review the Slack app logs for errors.
  • Authentication Problems: Ensure that your ServiceNow user account has the necessary permissions to access Slack resources.
  • Restart Services: Try restarting the ServiceNow IntegrationHub and Slack app.
  • Review ServiceNow System Logs: Examine the ServiceNow system logs for any error messages related to the integration.
  • Check Slack App Event Logs: Review the Slack app's event logs for any error messages or warnings.

Frequently Asked Questions

What is the best way to send ServiceNow notifications to Slack?

Using ServiceNow Flows with the "Send to Slack" action is the recommended approach as it offers flexibility and control over message formatting and routing.

Can I create incidents directly from Slack?

Yes, you can create incidents from Slack using Slack commands and a ServiceNow REST API endpoint.

Is IntegrationHub required for this integration?

Yes, ServiceNow IntegrationHub is the preferred and most robust method for integrating ServiceNow with Slack.

What permissions does the Slack app need?

The Slack app requires scopes like `chat:write`, `chat:write.public`, `commands`, `incoming-webhook`, and `users:read` to function correctly.

How do I troubleshoot if messages aren't being sent to Slack?

Check the Slack webhook URL, ServiceNow Flow configuration, and network connectivity. Review the ServiceNow system logs and Slack app event logs for errors.