# Webhooks

With webhooks, conversation data from sipgate AI Agents can be automatically forwarded to external systems. This means information from calls can be transferred directly into existing processes, for example into a CRM, a ticketing system, or internal reporting.

Webhooks are used whenever something should happen automatically after a conversation, without data having to be transferred manually.

{% hint style="info" %}
**Note:** For more complex integrations, we support you as part of our Enterprise offering. [**Schedule an appointment for custom integrations**](https://www.sipgate.ai/demo-buchen), to discuss suitable solutions together.
{% endhint %}

### What are webhooks used for?

Typical use cases include passing conversation summaries to a CRM, automatically creating support tickets after a call, or forwarding classifications and topics to analysis or reporting tools. Internal workflows can also be triggered in this way, such as notifications to teams or creating tasks.

### Requirements

To use webhooks, you need a destination URL to which the data should be sent. The receiving system must be able to process HTTP POST requests with a JSON payload.

### Set up webhooks

{% stepper %}
{% step %}
Open your **account management.**
{% endstep %}

{% step %}
Go to **AI Agents,** select the desired agent or create a new one. In the agent's user interface, you will find the navigation item **Webhooks**.
{% endstep %}

{% step %}
Enter one or more webhook URLs there, to which conversation data will be sent automatically after a call has ended.
{% endstep %}

{% step %}
Additional settings can optionally be configured, such as custom HTTP headers.
{% endstep %}
{% endstepper %}

After saving, the changes will be applied to all subsequent conversations of the agent.

### How webhooks work

After a call has ended, sipgate AI Agents creates a conversation log. The conversation data is then automatically sent via HTTP POST to the stored webhook URL. The data is transmitted as a JSON payload and can be stored or processed further in the target system.

A typical flow looks like this: a call ends, the conversation is summarized, and the information is forwarded directly to a connected system. Your team has the relevant data available immediately, without manual intervention.

#### Which data is transferred?

The webhook contains, among other things, metadata about the call, information about playbooks that were run, and a summary of the conversation including recognized topics.\
A shortened example of a payload looks like this:

{% tabs %}
{% tab title="ResponseType" %}

```javascript
type WebhookPayload = {
  version: "v1" | "v2";
  call: {
    id: string;
    from: string;               // phone number with "+" prefix, e.g. "+4921161234567"
    to: string;                 // phone number with "+" prefix, e.g. "+4930987654321"
    startTime: number;          // epoch milliseconds
    endTime: number;            // epoch milliseconds
    duration: number;           // duration in seconds
    direction: "in" | "out";
    users: {
      userId: string;
      accountId: string;
      fullUserId: string;
      firstName: string;
      lastName: string;
      fullName: string;
    }[];
  };
  assist?: {
    summary?: {
      content: string;
      keyPoints: string[];
      topics: string[];
    };
    callScenarios?: {
      name: string;
      smartAnswers: {
        setName: string;
        setItems: {
          question: string;
          answer: string;
          title?: string;
        }[];
      }[];
    }[];
    transcription?: {
      content: string;          // full transcription as text
      chunks: {
        speaker: "caller" | "callee";
        startTime: number;      // epoch milliseconds
        endTime: number;        // epoch milliseconds
        content: string;
      }[];
    };
  };
};
```

{% endtab %}

{% tab title="Example JSON" %}

```json
{
  "version": "v1",
  "call": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "from": "+4921161234567",
    "to": "+4930987654321",
    "startTime": 1703862000000,
    "endTime": 1703862300000,
    "duration": 300,
    "direction": "in",
    "users": []
  },
  "assist": {
    "summary": {
      "content": "Call about a delayed order.",
      "keyPoints": [
        "Inquiry about order status",
        "Identification unsuccessful"
      ],
      "topics": [
        "order status",
        "customer service"
      ]
    },
    "callScenarios": [
      {
        "name": "Order status",
        "smartAnswers": [
          {
            "setName": "Customer data",
            "setItems": [
              {
                "question": "What is the order number?",
                "answer": "B-2024-1234",
                "title": "Order number"
              }
            ]
          }
        ]
      }
    ],
    "transcription": {
      "content": "Hello, I'm calling about my order...",
      "chunks": [
        {
          "speaker": "caller",
          "startTime": 1703862000000,
          "endTime": 1703862010000,
          "content": "Hello, I'm calling about my order."
        },
        {
          "speaker": "callee",
          "startTime": 1703862011000,
          "endTime": 1703862020000,
          "content": "Hello, could you please tell me your order number?"
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

**Optional fields**

* `assist.summary` | Only present if a summary was created
* `assist.callScenarios` | Only present if playbooks were run through
* `assist.transcription` | Only present if transcription storage is enabled

The full payload can additionally contain information from playbooks, such as captured answers or classifications.

#### Security

To ensure that only requests from sipgate AI Agents are processed, the source IP address of incoming webhook requests should be checked.\
The requests come from the following IP address:

`217.116.118.254`

This address should be added to the receiving system's allow list to prevent unauthorized access.

#### Classification

Webhooks provide the basis for automation, but do not perform any processing themselves. What happens to the sent data is determined in the respective target system. In combination with playbooks, conversation logs, and analyses, end-to-end automated workflows can be built.


---

# 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://help.sipgate.de/ai-agents/en/connections-and-integrations/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.
