---
title: "Webhooks"
url: "https://help.magicblocks.ai/en/article/library-webhooks"
language: "en"
last_updated: "2026-03-18T09:19:32.791Z"
---

# Webhooks

Webhooks in [MagicBlocks](https://magicblocks.ai/hc) allow your AI Agents to automatically **send real-time data** to external systems when specific events occur — such as when a contact is captured, a conversation ends, or a form is submitted.

When certain **events** occur — for example, when an AI completes a goal or collects user data — MagicBlocks automatically sends an HTTPS POST request containing relevant event information to the endpoint you configure.

> 💡 Webhooks are especially useful for teams that want to integrate MagicBlocks data with other systems in real time, without needing complex code or external connectors.

## **How to Access**

Go to your **Workspace**.

From the left sidebar, navigate to **Library → Webhooks**.

Click **Create New Webhook** or open an existing one to configure it.

## **Webhook Structure**

Each Webhook setup includes several configurable components:

| Section | Description |
| --- | --- |
| **Webhook Name** | A descriptive name for identifying the webhook. |
| **Tags** | (Optional) Add tags to categorize your webhook for easy filtering. |
| **Status** | Set the webhook as<br>**Active**<br>or<br>**Inactive**<br>. Only active webhooks send data. |
| **Webhook URL** | The external endpoint (POST URL) where MagicBlocks will send event data. |
| **Headers** | Optional security or authorization headers, such as API keys or tokens. |
| **Webhook Events** | The triggers that cause this webhook to send data (e.g., “Agent goal achieved,” “New contact created”). |
| **Agents** | Choose which AI Agents can trigger this webhook. |
| **Test** | Use this button to send a test payload to your configured URL and verify it works. |

## **Webhook Config Tab**

Under the **Config** tab, you can define every detail of your webhook.

### 1\. Name and Tags

Give your webhook a clear, meaningful name (e.g., *Send Contact to CRM*, *Log Session Summary to Notion*).  
Tags help organize your workspace when you’re managing multiple integrations.

### 2\. Status

Toggle between **Active** and **Inactive**.  
Only active webhooks will send data when triggered.

### 3\. Webhook URL

Enter the **endpoint URL** where MagicBlocks should send POST requests.  
Example:

[`https://api.yourcrm.com/v1/contacts`](https://api.yourcrm.com/v1/contacts)

> Tip: You can test this endpoint directly using the **Test** button.

### 4\. Select Webhook Events

This defines **what triggers** your webhook. Common events include:

-   AI Agent goal completion
-   Session end or conversation closed
-   Form submission
-   Contact or contact created

Once you select events, the **Events endpoint structure** will display a preview of the JSON payload sent to your endpoint.

### 5\. Select Agents

You can scope the webhook to specific Agents — ensuring only data from certain AI workflows is sent externally.

### 6\. Headers

Add custom **key–value pairs** for authentication or configuration.  
Example:

| Header Key | Header Value |
| --- | --- |
| Authorization | Bearer<br>`YOUR_API_KEY_HERE` |
| Content-Type | `application/json` |

You can add multiple headers using **Add Header**.

> 🔒 Once saved, your header values are **permanently encrypted** for security and cannot be viewed again.

## **Use Cases**

| Use Case | Description |
| --- | --- |
| **CRM Sync** | Automatically push new contact data from AI conversations to HubSpot or Salesforce. |
| **Analytics Logging** | Send Agent activity to Google Analytics, Amplitude, or Mixpanel. |
| **Notification System** | Trigger a Slack or Discord alert when a high-value contact engages. |
| **Custom Dashboarding** | Stream Agent performance metrics to your internal BI dashboards. |
| **Data Capture** | Send form or session summaries to a Google Sheet via a custom endpoint. |

## **Example: Sending Contacts to HubSpot via Webhook**

Let’s say your AI Agent collects contact data and you want to send it to HubSpot automatically:

-   Go to **Library → Webhooks → Create New Webhook**.
-   Name it: *HubSpot Contact Sync*.
-   Set status to **Active**.
-   Add Webhook URL:
-   Add header:
-   **Key:** `Authorization`
-   **Value:** `Bearer YOUR_HUBSPOT_API_KEY`
-   Select Event: **Contact Created**
-   Select Agent: *Sales AI Agent*
-   Click **Save Config**.

Now every time a new contact is captured by that Agent, [MagicBlocks](https://magicblocks.ai/hc) will POST the contact's info directly to HubSpot.

## **Best Practices**

-   Use secure HTTPS endpoints for all Webhook URLs.
-   Include authentication headers (like API keys or bearer tokens).
-   Test your webhook before activating.
-   Keep payloads light — use Functions for complex data transformations.
-   Version and tag your webhooks for better organization.

## **Related Articles**

[Integrations: Webhooks](https://help.magicblocks.ai/en/article/integrations-webhooks)

[Webhooks on Goals](https://help.magicblocks.ai/en/article/webhooks-on-goals)
