# Webhook

The Webhook feature in the Gamify route is designed to help you automate and streamline the process of capturing and using campaign-related data in real-time. This feature enables you to send event data from the Gamify route system directly to your server, allowing for seamless integration with other systems and automation of various tasks.

### **What is a Webhook?**

A webhook is a method that allows you to send real-time data from one application to another when a specific event happens. Think of it like a notification system that tells another app to do something automatically. For example, when a user completes a game level, a webhook can send that information to your server to update records or trigger other actions. This process is automated and doesn't require manual intervention, making it efficient and timely.

### **Benefits of Using Webhooks**

* **Real-time Data Transfer**: Automatically receive data from the game as events occur.
* **Automation**: Trigger actions like updating databases, sending notifications, or creating records in CRM systems.
* **Integration**: Seamlessly connect with other tools and platforms, such as Pabbly or Zapier.

### **Enabling and Setting Up Webhooks**

To enable and set up a webhook for your Gamify route, follow these steps:

1. **Navigate to Webhook Settings**:

   * Go to **Campaign Details** > **Integration** > **Webhook**.

   <figure><img src="/files/gj41gQPXHcjPdfbRoFE9" alt=""><figcaption></figcaption></figure>
2. **Add a New Webhook**:

   * Click on the option to add a new webhook.

   <figure><img src="/files/0XQtA0mgxT1czqRNyddx" alt=""><figcaption></figcaption></figure>
3. **Configure Webhook Settings**:

   * **Webhook Name**: Enter a meaningful name for your webhook.
   * **Select Event**: Choose the event(s) that will trigger the webhook. Events could include actions like a user completing a level, achieving a high score, or any other significant activity within the game.

   <figure><img src="/files/v8o9GxR3fxyHqt3y607u" alt=""><figcaption></figcaption></figure>

   * **Webhook URL**: Provide the URL of the server endpoint that will receive the webhook data. This URL will be invoked when the selected event occurs.

     * Example: Users often use URLs from services like Pabbly or Zapier to create automations based on the received data.

     <figure><img src="/files/DoFamT0zpB1VO8YCXaws" alt=""><figcaption></figcaption></figure>
   * **Description**: Write a brief description of the webhook to help you remember its purpose.
   * **Method**: Select the HTTP method (GET, POST, etc.) that your endpoint expects.
   * **Status**: Ensure the status is set to **Active**. If it is set to **Inactive**, the webhook will not send any data.
   * **Headers**: Add any necessary headers for the API call, such as authentication tokens or content type specifications.
4. **Understanding Webhook Data**:

   * **Example Tab**: Refer to the example tab to learn about the basic response format of the event data. This will help you manage your database tables and other systems according to the data structure.

   <figure><img src="/files/WVL5afxHfkddrjNVS2T0" alt=""><figcaption></figcaption></figure>

   * **History Tab**: View the history of all past events triggered by this webhook to monitor and debug as needed.

   <figure><img src="/files/lDSst61tBdScANMwm3a9" alt=""><figcaption></figcaption></figure>

### **Managing Webhook Data**

Once your webhook is set up and active, it will start sending event data to your specified endpoint in real-time. You can use this data to perform various actions, such as:

* **Updating Databases**: Automatically update your databases with new game data.
* **Sending Notifications**: Trigger notifications to users or administrators based on specific events.
* **Integrating with CRMs**: Create or update records in your CRM system using the event data.

**Example Use Case**

Consider a scenario where you want to create a new user in your CRM system every time a player completes a specific level in the game (e.g. Opt-in submit). You can set up a webhook to trigger when the level completion event occurs, send the player's information to a service like Zapier, which then integrates with your CRM to create the new user.

### **Troubleshooting**

* **Inactive Webhook**: Ensure the status of your webhook is set to **Active**.
* **Incorrect URL**: Verify that the webhook URL is correct and that your server endpoint is configured to handle the incoming data.
* **Missing Headers**: Ensure all necessary headers are included in the webhook setup for authentication and data formatting.

### **Conclusion**

Webhooks are a powerful tool for automating tasks and integrating systems in real-time. By setting up and managing webhooks in the Gamify route, you can enhance the functionality of your application and improve the efficiency of your workflows. If you have any questions or require further assistance, please do not hesitate to contact our support team.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gamifyroute.com/kb/campaign-details/integrations/webhook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
