# Webhook

Gallabox offers a Webhook feature that allows you to set up real-time integration with external systems or services. This feature enables you to send data and notifications from Gallabox to other platforms, ensuring seamless communication and automation. Here is the key components in Webhook configuration:

1. **Request URL:** The Request URL is the endpoint where Gallabox sends data and events. This is typically an external system or service that can receive HTTP requests. You specify the URL of the receiving system here.

### Add New Webhook

Go to **Settings** in the left navigation panel and select **Webhook**. Click on **+ Add new**.

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FPfWzS7TiMpIlcqXBisrb%2FAdd%20new%20Webhook.gif?alt=media&#x26;token=d5a94212-32c2-45fe-af51-af4d0439759b" alt=""><figcaption></figcaption></figure>

### Add Details of Webhook

Add the Request URL, secret, headers, and select the events.&#x20;

<table><thead><tr><th width="172">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Request URL*</strong></td><td>Enter the URL where the webhook notifications will be sent.</td></tr><tr><td><a href="#verifying-requests-from-gallabox"><strong>Secret</strong></a></td><td>Optionally, enter a secret token for added security.</td></tr><tr><td><strong>Headers</strong></td><td>Optionally, customize HTTP headers for the webhook request.</td></tr><tr><td><strong>Select Events*</strong></td><td>Choose from a variety of events for which notifications will be triggered.</td></tr></tbody></table>

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FfmXn5hQjnZQeHzkIOKNX%2FCreate%20Webhook.gif?alt=media&#x26;token=9ab957e8-e68c-4964-8341-8283ab3f39e6" alt=""><figcaption></figcaption></figure>

### Webhook Events

Users can select from the following categories of events:

#### **Contact**

<table><thead><tr><th width="211">Event</th><th>Descrition</th></tr></thead><tbody><tr><td><strong>Contact.created</strong></td><td>Triggered when a new contact is created.</td></tr><tr><td><strong>Contact.updated</strong></td><td>Triggered when an existing contact is updated.</td></tr><tr><td><strong>Contact.mapped</strong></td><td>Triggered when a contact is mapped to another entity.</td></tr><tr><td><strong>Contact.unmapped</strong></td><td>Triggered when a contact is unmapped from an entity.</td></tr></tbody></table>

#### **Conversation**

<table><thead><tr><th width="272">Event</th><th>Description</th></tr></thead><tbody><tr><td><strong>Conversation.created</strong></td><td>Triggered when a new conversation is initiated.</td></tr><tr><td><strong>Conversation.updated</strong></td><td>Triggered when an existing conversation is updated.</td></tr><tr><td><strong>Conversation.UnAttended</strong></td><td>Triggered whenever autoReply message is being sent.</td></tr><tr><td><strong>Conversation.Tag.mapped</strong></td><td>Triggered when a tag is mapped to a conversation.</td></tr><tr><td><strong>Conversation.Tag.unmapped</strong></td><td>Triggered when a tag is unmapped from a conversation.</td></tr></tbody></table>

#### **Message**

<table><thead><tr><th width="348">Event</th><th>Description</th></tr></thead><tbody><tr><td><strong>Message.received</strong></td><td>Triggered when a new message is received.</td></tr><tr><td><strong>Message.flow.received</strong></td><td>Triggered when a message flow is received.</td></tr><tr><td><strong>Message.WA.Cart.received</strong></td><td>Triggered when a cart message is received on WhatsApp</td></tr><tr><td><strong>Message.WA.status.received</strong></td><td>Triggered when the status of a WhatsApp message is received.</td></tr><tr><td><strong>Message.WA.status.failed</strong></td><td>Triggered when a WhatsApp message fails to send.</td></tr><tr><td><strong>Message.WA.Payment.status.received</strong></td><td>Triggered when the status of a payment message sent via WhatsApp is received.</td></tr><tr><td>M<strong>essage.WA.Interaction.Received</strong></td><td>Captures only the reply, clicks, and reaction for the Message</td></tr></tbody></table>

#### **Template**

<table><thead><tr><th width="189">Event</th><th>Description</th></tr></thead><tbody><tr><td><strong>Template.status</strong></td><td>Triggered when the status of a message template changes.</td></tr></tbody></table>

### Webhook Logs

Webhook Logs provide detailed information about webhook events, their status, and associated data. Here's what you can find in the Webhook Logs in Gallabox:

<table><thead><tr><th width="175">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Webhook Log ID</strong></td><td>This is a unique identifier for each webhook log entry, enabling easy reference and tracking of webhook activities.</td></tr><tr><td> <strong>Event</strong></td><td>The "Event" column specifies the type of event that triggered the webhook. For example, "Conversation Update" or "Message Received."</td></tr><tr><td><strong>Created At</strong></td><td>This timestamp indicates when the webhook event occurred, offering a chronological view of webhook activities.</td></tr><tr><td><strong>Status</strong></td><td>The "Status" field represents the current state of the webhook event. In this context, "Failed" indicates that the webhook event was not successful.</td></tr><tr><td><strong>Payload</strong></td><td>The "Payload" refers to the data associated with the webhook event. It includes the content or information transferred from Gallabox to the external system or service via the webhook.</td></tr></tbody></table>

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FO9V4AYJhQGRfq8m9xTTk%2FWebhook%20Logs.png?alt=media&#x26;token=fcda9cc3-aad3-40c0-bc76-cf59f60685d5" alt=""><figcaption></figcaption></figure>

### Verifying requests from Gallabox

Gallabox secures its requests with a unique secret (configured by you) specific to webhooks. Using the webhook secrets, your app can more reliably confirm the authenticity of Gallabox requests.&#x20;

#### Validating a Request

To verify the requests, follow these steps:&#x20;

1. **Retrieve the signature**: Extract the signature from the x-gallabox-signature header in the incoming HTTP request.&#x20;
2. **Create a hash**: Generate an HMAC SHA-256 hash using your webhook secret and the request payload.&#x20;
3. **Compare with the signature**: Compare the generated hash with the signature from the HTTP header.&#x20;

If the hash and the signature match, the request is verified as originating from Gallabox and can be processed. If not, the request should be rejected.&#x20;

{% hint style="info" %}
For enhanced security, keep the secrets confidential and update regularly.&#x20;
{% endhint %}

### Whatsapp Channel webhook check

In WhatsApp Channel, users can verify if the webhook is set up correctly. If issues are detected, a "Fix Channel Issue" button appears. Clicking it will properly configure the webhook for that channel.

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>
