Kontent.ai: Use of Webhooks

Introduction

You use Webhooks to integrate Kontent.ai with other applications and automate your processes. Think of webhooks as programmatic notifications that let your application know when something changes in your CMS. Also, when webhooks are used, you are immediately notified about changes to any content items.

In the Kontent.ai system, you can define specific webhooks which call predefined endpoints with query parameters. The XTM Connect – Kontent.ai plugin is able to process webhook calls. Only webhooks that are predefined in the Kentico Kontent administrator panel will be processed.

In the vast majority of cases, the connector uses webhooks to automate the process of submitting content to the XTM Cloud translation queue, based on the Kontent.ai workflow step in which that particular content is.

In the vast majority of cases, the connector uses webhooks to automate the process of submitting content to the XTM Cloud translation queue, based on the Kontent.ai workflow step in which that particular content is.


How to create and apply a sample webhook

  1. In Kontent.ai, for a particular environment, go to Environment settingsWebhooks.

  1. In the General section:

  • Webhook name → Enter a unique name for your webhook so that you can easily identify its purpose.

  • URL address → This is the most important field to fill. In it, enter the URL address of a Kentico Kontent administrator panel, define the type of action that will trigger this webhook and set all mandatory and optional parameters.

    • EXAMPLE: https://kontent-connector.xtm-intl.com/api/kontent/webhook/item/translate/workflowstepevent?source_language=en_GB&target_languages=pl-PL&xtm_customer_id=321974&xtm_template_id=256192&project_name=WEBHOOK_PROJECT

      • URL address of a Kentico Kontent administrator panel → https://kontent-connector.xtm-intl.com;

      • Action type → workflowstepevent;

      • Mandatory parameters → source_language and target_languages from the CMS;

      • Optional parameters → xtm_customer_id, xtm_template_id, project_name;

        • Other optional parameters → due_date, description, update_xtm_project, workflow_step;

  • Secret → Webhook unique secret. Not used much.

  1. In the Triggers section, specify all the actions that will cause the webhook to activate. When you create a webhook that will only submit content to the XTM Cloud translation queue on the basis of a particular Kontent.ai workflow step, only the Management API triggers → Transition to specific workflow step to watch field is important. In it, specify which Kontent.ai workflow step will trigger submission of the content to the XTM Cloud translation queue. Finally, to create the webhook, click Save at the bottom of the page.

  1. In the Kentico Kontent administrator panel, go to Kontent.ai Projects → (select a relevant Kontent.ai project) → Webhooks. In this step, your newly created webhook needs to be applied to a specific Kontent.ai project. Select the webhook in the Webhooks field. Also, in the Users for webhooks section, select users that will receive notifications about events that result from specific user actions in the CMS UI. Do not forget to save the changes afterwards.

  1. Now, as shown in the example webhook above, you change a workflow step for a particular content item to XTM_Translation, in Kontent.ai.


Webhook notifications

In Kontent.ai, go to Environment settingsWebhooks. Next, find a relevant webhook and click on the Debugging icon.

You will see the history of all the notifications this webhook has triggered. For each, the history shows its Status, Date of creation and Notification contents.

Additionally, you can filter by: Show failed and delivered, Show all failed or Show last response failed.