Configure the Bot as an Incoming Webhook Notifier

Next, let’s configure the bot as an incoming webhook notifier, that performs actions when the webhook URL is invoked on GitHub. You can do this in the following way:

  1. Generate a webhook token on the Cliq bot
  2. Obtain the App Key of your extension
  3. Obtain the webhook handler URL of your extension
  4. Create a webhook on GitHub and configure these values

We will discuss these actions in detail one after the other.

This webhook gets triggered whenever a commit is pushed to one of the repositories on your Git account. When that event occurs, GitHub makes an HTTP request to the URL webhook handler URL with the credentials that we configure. It will pass the details of that push event to Cliq, and the Cliq bot will notify you of it and display the details.

Generate a WebHook Token

You can generate a webhook token on Cliq as described below. The webhook token is authenticated by the authenticate button function that we configured in the previous step.

  1. Search for the GitHub bot in your Cliq account. Select the bot and click Continue. catalyst_gitbot_cliq_bot_search

  2. Provide permission for the bot to access your account details. catalyst_gitbot_cliq_bot_permissions
    The chat will be activated.

  3. Type “webhooktoken” in the chat and press Enter. catalyst_gitbot_cliq_bot_webhook_create_1

  4. Click the Create Webhook button.

  5. Allow the extension to access your authorization token. catalyst_gitbot_cliq_bot_webhook_create_2

  6. The bot will now generate and display the webhook token. Copy this token. catalyst_gitbot_cliq_bot_webhook_create_3

This webhook token will be the value of the zapikey parameter in the URL that we will configure on GitHub.

Obtain the App Key

You can obtain the App Key of the extension in the following way:

  1. Click on the GitHubExt extension from the extensions page in the Cliq developer console, then navigate to the Connectors section.

  2. Copy the Sandbox App Key of your extension.
    catalyst_gitbot_cliq_sandbox_key
    This key will be the value of the appkey parameter in the URL that we will configure on GitHub.

Obtain the Webhook Handler URL

You can obtain the Webhook Handler URL of the extension in the following way:

  1. Navigate back to your Cliq account and click on your profile picture. Click on Bots & Tools in the menu section.
    catalyst_gitbot_cliq_webhookurl_1

  2. Click on the GitHub Bot from your bots list. This will open a side panel. Copy the URL displayed under Incoming WebHook Endpoint.
    catalyst_gitbot_cliq_webhookurl_2

This will be the base URL that we will configure on GitHub.

Create a Webhook on GitHub

The complete URL to configure on GitHub is:

baseURL?appkey={{appkey}}&zapikey={{zapikey}}

where baseURL is the webhook handler URL, appkey is the sandbox App Key of your extension, and zapikey is the webhook token generated on Cliq.

For example:

https://cliq.zoho.com/company/org_id/api/v2/githubbot/incoming?appkey={{appkey}}&zapikey={{zapikey}}

Let’s now add this URL on GitHub in the following way:

  1. Open your GitHub account and navigate to any one of your repositories.

  2. Open your repository’s settings, then click Webhooks -> Add webhook. catalyst_gitbot_git_add_webhook_1

  3. Enter the URL in the format specified above, substituting the values of appkey and zapikey. Configure the webhook as shown below. catalyst_gitbot_git_add_webhook_2

You can select the events that you would like to be notified about.

  1. Click Add webhook.

This webhook will now enable alerts for the configured events in your repository.

Last Updated 2023-12-15 18:54:08 +0530 +0530

RELATED LINKS

Integration Functions