Set up bi-directional webhook for the GitLab spoke
Configure a webhook to subscribe to GitLab with a ServiceNow callback URL.
Before you begin
- Request Integration Hub subscription
- Activate the GitLab spoke
- Role required: admin
Register GitLab webhook in ServiceNow instance
Register GitLab in ServiceNow to notify the ServiceNow app when certain events occur in GitLab.
Before you begin
Role required: admin
Procedure
Navigate to All > GitLab Webhooks > GitLab Webhook Registries.
To retrieve the existing webhooks GitLab account, click Get All Webhooks.
To create a webhook, click New.
On the form, fill in the fields:
Fields Description Name Name of the webhook. For example, Job webhook.Description Description of the record. Project ID Unique identifier of the project for which the webhook should be created. Trigger and SSL Events in the projects you want to subscribe to. When one of these events occurs, the webhook is triggered. Click the Generate Secret Token related link.
The secret token is generated and displayed. Also, the date on which the secret expires is populated in Secret Expires.
Note: The secret is regenerated and updated every 30 days. This secret is also updated in GitLab.
Right-click the form header and click Save.
Click Create Webhook.
The webhook is created in GitLab and its ID is populated in Webhook ID.
What to do next
To update details of the webhooks or change the subscribed events, click Update Webhook.
Customize a bi-directional webhook in the GitLab spoke
Create webhook routing policy and subflow as per your requirement in the GitLab spoke.
Before you begin
Role required: admin
About this task
The default routing policy in the GitLab WebHook Routing Policies modules triggers the relevant GitLab subflow and notifies the ServiceNow app when certain events occur in GitLab. To use any other fields in your custom subflow and customize conditions in the routing policy, perform these steps.
Procedure
Navigate to All > Flow Designer > Designer.
Click Subflows.
Create a copy of the required subflow.
Customize the required subflow as per your requirement and publish it.
See Building subflows for more information about creating and using subflows and GitLab spoke for information about the GitLab fields that the default routing policy supports and the GitLab events that the subflows support.
Navigate to All > GitLab Webhooks > GitLab Webhook Routing Policies.
Five routing policies are available along with the spoke. You can configure them as per your requirement or create a routing policy.
To create a routing policy, click New.
On the form, fill in the fields.
| Field | Description |
|---|---|
| Label | Unique label to identify the routing policy. |
| Default answer | Option to specify if this is the default answer. Default answer is applicable when the conditions are not met. 1. Click the Lookup icon. 2. Select the required subflow from the Document: list. Note: Ensure that the Table name is |
| Condition | Conditions to be met when the required events occur in GitLab. |
| Answer | Subflow that has to be triggered when the specified conditions are met. |
Click Submit.
Note: These routing policies are saved in the Decision tables. Users are cautioned against directly updating or modifying data in these tables.
Result
Routing policy and subflow are created.