{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":21595,"path":"integrate-applications/integration-hub/setup-webhook-gitlab.md","title":"Set up bi-directional webhook for the GitLab spoke","bundle":null,"doc_type":null,"release":"australia","body":"\n# Set up bi-directional webhook for the GitLab spoke\n\nConfigure a webhook to subscribe to GitLab with a ServiceNow callback URL.\n\n## Before you begin\n\n-   Request Integration Hub subscription\n-   Activate the GitLab spoke\n-   Role required: admin\n\n## Register GitLab webhook in ServiceNow instance\n\nRegister GitLab in ServiceNow to notify the ServiceNow app when certain events occur in GitLab.\n\n### Before you begin\n\nRole required: admin\n\n### Procedure\n\n1.  Navigate to **All** &gt; **GitLab Webhooks** &gt; **GitLab Webhook Registries**.\n\n2.  To retrieve the existing webhooks GitLab account, click **Get All Webhooks**.\n\n3.  To create a webhook, click **New**.\n\n4.  On the form, fill in the fields:\n\n    |Fields|Description|\n    |------|-----------|\n    |Name|Name of the webhook. For example, `Job webhook`.|\n    |Description|Description of the record.|\n    |Project ID|Unique identifier of the project for which the webhook should be created.|\n    |Trigger and SSL|Events in the projects you want to subscribe to. When one of these events occurs, the webhook is triggered.|\n\n5.  Click the **Generate Secret Token** related link.\n\n    The secret token is generated and displayed. Also, the date on which the secret expires is populated in **Secret Expires**.\n\n    **Note:** The secret is regenerated and updated every 30 days. This secret is also updated in GitLab.\n\n6.  Right-click the form header and click **Save**.\n\n7.  Click **Create Webhook**.\n\n    The webhook is created in GitLab and its ID is populated in **Webhook ID**.\n\n\n### What to do next\n\nTo update details of the webhooks or change the subscribed events, click **Update Webhook**.\n\n## Customize a bi-directional webhook in the GitLab spoke\n\nCreate webhook routing policy and subflow as per your requirement in the GitLab spoke.\n\n### Before you begin\n\nRole required: admin\n\n### About this task\n\nThe 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.\n\n### Procedure\n\n1.  Navigate to **All** &gt; **Flow Designer** &gt; **Designer**.\n\n2.  Click **Subflows**.\n\n3.  Create a copy of the required subflow.\n\n4.  Customize the required subflow as per your requirement and publish it.\n\n    See [Building subflows](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/subflows.md) for more information about creating and using subflows and [GitLab spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/gitlab-spoke.md) for information about the GitLab fields that the default routing policy supports and the GitLab events that the subflows support.\n\n5.  Navigate to **All** &gt; **GitLab Webhooks** &gt; **GitLab Webhook Routing Policies**.\n\n    Five routing policies are available along with the spoke. You can configure them as per your requirement or create a routing policy.\n\n6.  To create a routing policy, click **New**.\n\n7.  On the form, fill in the fields.\n\n<table id=\"table_iqz_j5s_h5b\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nLabel\n\n</td><td>\n\nUnique label to identify the routing policy.\n\n</td></tr><tr><td>\n\nDefault answer\n\n</td><td>\n\nOption to specify if this is the default answer. Default answer is applicable when the conditions are not met. 1.  Click the Lookup icon.\n2.  Select the required subflow from the **Document:** list.\n\n**Note:** Ensure that the **Table name** is `Flow [sys_hub_flow]`.\n\n</td></tr><tr><td>\n\nCondition\n\n</td><td>\n\nConditions to be met when the required events occur in GitLab.\n\n</td></tr><tr><td>\n\nAnswer\n\n</td><td>\n\nSubflow that has to be triggered when the specified conditions are met.\n\n</td></tr></tbody>\n</table>8.  Click **Submit**.\n\n    **Note:** These routing policies are saved in the Decision tables. Users are cautioned against directly updating or modifying data in these tables.\n\n\n### Result\n\nRouting policy and subflow are created.\n\n"}}