# Webhooks

Webhooks allow you talk with your embeds on custom way.&#x20;

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

Using webhooks, you can enable real-time communication with your app. Aicado sends notifications via webhooks to users who request them. In addition to the standard notifications, users can assign custom parameters to webhooks, allowing you to manage specific types of data that meet your needs. These parameters enable the information sent to Aicado to be directly returned via webhook, which is ideal for tasks like user authentication.

{% hint style="info" %}
For using webhooks on AI Models, your platform or tech stack must allow webhooks.
{% endhint %}

Here is how you can enable webhooks on your embeddable AI tool 👇🏻

**1. Setting Up Webhooks**

1. **Access the Embeddable AI Tool:**
   * Log in to your Aicado account and navigate to your AI agent on.
2. **Generate & Configure Webhook URL:**
   * Click on the "Features" tab and enable "Webhook" option to generate a unique webhook URL for your AI agent.
   * Go to your application's settings or configuration panel.
   * Copy the generated webhook URL on your application and paste your webhook url on related input at Aicado.

**2. Custom Parameters**

1. **Define Custom Parameters:**
   * In the embeddable AI tool, you can define custom parameters that will be included in the webhook payload.
   * These parameters allow you to pass specific data to and from the AI model.
2. **Assign Custom Parameters:**
   * When configuring the webhook, you can assign values to these custom parameters based on the data you want to track or manage.
   * For example, you can assign parameters like `user_id`, `session_id`, `timestamp`, or any other relevant data.

{% hint style="danger" %}
Some parameters are restricted from Aicado, you'll not be able to assign this custom parameters: a\_id, at, old\_id, s, t, audi, sl, raid, u\_id, muser.
{% endhint %}

**3. Handling Webhook Events**

1. **Receive Webhook Events:**
   * When an AI model is triggered, Aicado will send a POST request to the configured webhook URL with the specified custom parameters and the AI model's response.
   * Ensure your application can handle incoming POST requests and process the data accordingly.
2. **Process and Store Data:**
   * In your application, create a handler to process the incoming webhook data.
   * Use the custom parameters to organize and store the data as needed.
   * For example, you can store responses in a database, trigger specific actions based on the AI model's output, or update user sessions with new information.

**Example Use Case**

Imagine you have a customer support application that uses Aicado's AI to analyze customer queries and provide automated responses. By setting up a webhook, you can:

1. **Receive Real-Time Responses:**
   * When a customer submits a query, the AI model processes it and sends the response to your application via the webhook.
2. **Track User Sessions:**
   * Use custom parameters like `user_id` and `session_id` to track which user asked the query and update their session with the AI's response.
3. **Store Query Data:**
   * Save the query and response data in your database for future reference or analysis.

By leveraging webhooks and custom parameters, you can create a dynamic and responsive embed with Aicado's AI models, tailored to your specific needs. For further assistance, feel free to [contact us.](https://aicado.ai/contact)


---

# 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.aicado.ai/creating-ai-agent/features/webhooks.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.
