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.

search_bot

  1. Provide permission for the bot to access your account details.

allow_access

The chat will be activated.
  1. Type “webhooktoken” in the chat and press Enter. Then click Create Webhook.

create_webhook

  1. Click Create Webhook. In the pop up that appears, we will need to enter the webhook token of the bot.

webhook_popup

To fetch the webhook token, click on the Profile icon in the top right corner of the page.

click_profile

Click Bots & Tools.

bots_and_tools

Click on Webhook Tokens in the Integrations menu.

webhook_tokens

Click Generate New Token and copy the generated token.

copy_token

Paste the token value in the pop-up and click Submit.

paste_token

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.

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.

select_bots_tools

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

incoming_webhook_endpoint

This will be the baseURL 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.

add_webhook

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

configure_url

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

  1. Click Add webhook.

configure_events

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