Couchbase Capella™, our Database-as-a-Service offering, provides customers with a fully managed experience with performance, scalability, security, and manageability built in. Now, with webhook alert integration, customers can easily get Capella alerts in their third-party tools and use existing workflows to track, investigate, and resolve service issues across your various workloads in a centralized manner.
Couchbase Capella already provides email notifications for alerts but this alone can sometimes be limiting to medium and large enterprises. SREs and developers often want to be notified in their tool of choice when alerts are generated in their Couchbase Capella Services. With this new capability, customers can now integrate Capella alerts with tools like ServiceNow via an incoming webhook that they can configure on Capella.
What are Webhooks?
Webhooks are user-defined HTTP callbacks. When an alert occurs in Capella, an HTTP request is made to the webhook URL configured by the user, sending the JSON alert payload. This allows customers to invoke custom behavior on their third-party applications.
As a Capella customer, you can use ServiceNow or another issue management system as a single unified tool to manage all the issues centrally for your IT environment. For example, whenever an alert occurs in Capella you can automatically create an Incident in ServiceNow the way that you do for incidents generated by other applications.
Integrate Capella Alerts using Webhooks
The Capella alert integration feature is generic. You can configure alert integrations for any third-party tool that supports an incoming webhook. An alert integration requires the destination URL for the webhook and either basic or bearer token authentication and authorization.
Here are some of the key feature details:
-
- Create, edit, and delete configuration using UI or Public Management API.
- Authentication using Basic (username/password) or bearer token (access token).
- Requires a secure connection, so the incoming Webhook URL must begin with https.
- Needs Enterprise or Developer Pro subscription.
- Available for both Databases and App Services.
- Rather than define alert integrations repetitively for every Database or App Service, you configure a single alert integration at the project level. You can limit the notifications that an alert integration sends by excluding specific Databases or App Services.
The notification messages that an alert integration sends include a payload that provides all the alert details in a set of easy-to-read JSON objects.
Tutorial to receive Capella alerts in ServiceNow
Create a ServiceNow developer account, if you need one. Use the Scripted REST APIs feature and create a new resource. To use basic authentication for your webhook, create a new user in ServiceNow with the credentials you will use for authentication. Note down the URL and the authentication details.
In Capella, add an alert integration to the project with the key details: Name, Webhook URL, and Authentication information. Capella offers both a UI and a Capella Management API for working with alert integrations. Test the connection and add the integration.
Now, when any metric-derived critical- or warning-level alert occurs in Capella Databases or App Services, it is automatically sent to ServiceNow.
Setup on ServiceNow
Create a ServiceNow developer account if you need one.
Make sure the user role is set as Admin. Click Start building to login to a developer instance.
Search for Scripted REST APIs, and click the New button on the top right of the page to create a new resource. Fill in the API name and click Submit.
You should now see your API listed on the page. Click the API name to open a configuration page. In the bottom section of this page, under Resources, select New.
Enter your preferred name for the resource and set the HTTP method as POST. You can use the script example below to log the request JSON to the System Log. For more script examples, see this ServiceNow link.
Below is another script example that creates an incident in the Service Desk=>Incidents section:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
var requestBody = JSON.parse(request.body.dataString); gs.log("Received request to create incident: " + JSON.stringify(requestBody)); // Create a new incident record var incidentGR = new GlideRecord('incident'); incidentGR.initialize(); incidentGR.short_description = requestBody.details.summary; incidentGR.description = JSON.stringify(requestBody); // Set other incident fields as needed var sysId = incidentGR.insert(); // Insert the incident record gs.log("Incident created with sys_id: " + sysId); // Return response response.setStatus(201); response.setContentType('application/json'); response.setBody({"sys_id": sysId, "message": "Incident created successfully"}); |
Click on Explore REST API link to make a note of the assigned URL. This is the Webhook URL you will use in Capella to set up the integration.
-
- To use basic authentication for your webhook, you need to create a new user in ServiceNow.
- Under User Administration=>Users create a new user.
- Find the newly created user and Set Password. Generate a new password, make sure to uncheck Password needs reset, and update the user. You will use these user credentials in Capella to set up the integration.
- To use basic authentication for your webhook, you need to create a new user in ServiceNow.
Things are now set up in ServiceNow. Let’s head over to the Capella UI.
Setup on Capella
-
- Login to Capella UI.
- Select a Project in Capella and click on the “Alerts” tab.
- Click on “Add Integration”.
- Provide a user-friendly Display Name.
- Provide the ServiceNow Webhook URL, select Authentication as “Basic” and provide the Username and Password.
- Click “Test Connection” to validate that the connection is working.
- The “Test connection” in Capella will send a test JSON alert payload to the Webhook URL in ServiceNow. Save the integration.
Review the received test alert in ServiceNow.
In ServiceNow select All => System Log => Script Log Statements and filter logs to see the Capella TestAlert being received.
Wrap Up
Congratulations! You are successfully set up to receive real-time Capella alerts in ServiceNow. While the above step-by-step procedure is detailed for ServiceNow, the Capella alert integration feature is generic. You can configure alert integrations for any third-party tool that supports an incoming webhook and either basic or bearer token authentication and authorization.
Conclusion
Capella alert notifications integration can be used to receive alerts in the third-party tool of your choice. This allows you to track, investigate, and resolve service issues across your various workloads centrally using familiar workflows.
Here are some additional resources that you may find useful:
If you are new to Couchbase Capella, give it a try and see how a multi-purpose database platform can help you build powerful applications. You can get up and running in minutes with a free trial (no credit card needed). Capella iQ’s generative AI is built right in and can help you start writing your first queries with natural language text.