Skip to main content
The Keywords AI platform provides a webhook system that allows you to receive notifications when certain events occur. For example, when Keywords AI logs a new request, your webhook and point can receive this notification as an API call from Keywords AI.

Authentication

Keywords AI uses digital signature strategy for webhook data verification. The data sent from Keywords AI undergoes the following process before you can use it:
  1. The data is ready in Keywords AI’s backend
  1. The Keywords AI encodes the data with your API Key string retrieved from the action’s header (we don’t store your API key) that triggers the webhook, using SHA-256 algorithm.
  1. The signature is then passed to X-Keywordsai-Signature. This is case sensitive.
  1. You can verify then data and accept or reject the payload

Using Webhook Secrets

Instead of using your API key for webhook signature verification, you can use a dedicated webhook secret. This provides better security by allowing you to use a separate secret specifically for webhook validation without exposing your API key. When creating or editing a webhook in the Keywords AI platform, you can copy the webhook secret and use it for signing the signature instead of using the API key.
webhook_secret_v0
To use the webhook secret, simply replace YOUR_KEYWORDS_AI_API_KEY with your webhook secret in the verification code:

Example for using Webhooks

  1. Define a webhook endpoint in your application.
This endpoint sends an email to the admin when a webhook event is received.
Django
  1. Create a new webhook in the Keywords AI platform.
    1. Go to the Webhooks page in the Keywords AI platform.
    2. Click on the “Create Webhook” button, a modal will appear.
    1. Define the webhook URL. In this demo, it is http://localhost:8000/api/webhook/.
    2. Define the event type that triggers the webhook. In this demo, it is New request log (when an API call is logged).
    3. Define the API Key you want to associate this webhook with. In this demo, it is an admin development key.
    4. (Optional) Copy the webhook secret from the webhook settings if you want to use it instead of the API key for signature verification.
    5. Click on the “Create” button.
  2. Make an API call to the chat completion endpoint
  3. Receive the email.