
When the agent recognizes a reaction, for example **Positive**, it can also trigger a webhook. This lets you start your own workflow, for example in n8n, Make or Zapier. One example: the lead says yes, your workflow creates a profile analysis, and the agent includes the link in its reply.

**Contents**
- [Requirements](#requirements)
- [Set up the webhook](#set-up-the-webhook)
- [Notify only or wait for result](#notify-only-or-wait-for-result)
- [What you receive](#what-you-receive)
- [Send the result back](#send-the-result-back)
- [Test and activate](#test-and-activate)
- [Verify the signature](#verify-the-signature)
- [If nothing comes back](#if-nothing-comes-back)
- [Regenerate existing drafts](#regenerate-existing-drafts)

## Requirements

- Scale plan or agency account. On other plans you see the row with a lock.
- You may edit the agent (owner, admin or owner of the sending profile).
- A publicly reachable `https://` address that accepts POST requests and does not redirect.

## Set up the webhook

1. Open your agent, **Replies** tab, and click the reaction, for example **Positive**.
2. On the right under **Edit**, the last row is **Automation (optional)**. Expand it.
3. Enter your webhook URL, choose the mode and click **Save**.
4. Test the webhook (see below), then tick **Webhook active**.

When the webhook is active, the reaction card shows a small lightning icon.

## Notify only or wait for result

- **Notify only:** inDeal sends the data to your URL, the agent replies as usual.
- **Wait for result:** the agent holds its reply and waits up to 30 minutes for your result. Then the draft is created as usual, with approval or via autopilot.

In **Wait for result** mode you can write a template with your own placeholders for every reaction, for example:

`Here is your analysis: {{link}} (score {{score}}). Would a short call work for you?`

For **Positive**, the field **Template with result** only appears in this mode.

The template is optional. If you leave it empty, the agent writes the reply itself from your workflow's data: it copies links character for character and works values such as the score into the text. If you send a ready-made text, for example as `nachricht` or `text`, the agent uses it as the core of the reply and only adapts the form of address to the conversation. For **Positive**, the reply always ends with two concrete times from your time windows, for example "Does tomorrow at 10 am or next Monday at 2 pm work for you?". The agent replaces an open question such as "When works for you?" with this question. This also applies to a template without `{{slot_1}}` and `{{slot_2}}`: the agent adds the question at the end.

The webhook triggers at most once per lead and reaction.

## What you receive

inDeal sends a POST with JSON, including:

| Field | Content |
|---|---|
| `request_id` | unique ID of this call |
| `reaction` | the recognized reaction, e.g. `positive` |
| `agent_id` | ID of the agent |
| `lead_id`, `name`, `position`, `company`, `linkedin_url` | lead data |
| `reply_text` | the lead's reply |
| `callback_url`, `callback_token` | only for **Wait for result** |

When triggered, the lead's name, position, profile link and reply are sent to your URL. You are responsible for further processing.

## Send the result back

Send your result as a POST to the `callback_url` and set the token as a header:

```
Authorization: Bearer <callback_token>
Content-Type: application/json

{ "variables": { "score": 87, "link": "https://..." } }
```

- `variables` fill the placeholders of your template (`{{score}}`, `{{link}}`). Without a template, the agent writes the reply from these values. Names in lowercase, values as text or number. Fixed variables such as `first_name` cannot be overwritten.
- Optional `"message": "..."`: this text is used word for word as the reply. The only exception is **Positive**: if the two proposed times are missing, the agent adds the question with both times as a separate paragraph, your text itself stays unchanged. If it contains an open question such as "When works for you?", the card shows a note and the draft is not sent by autopilot.
- If the agent cannot write a reply from your data, or the draft does not use it, the card shows a note. Such a draft is never sent by autopilot.
- The token is valid only for this call, only once and only for 30 minutes.

## Test and activate

- **Send test** sends a sample lead to your URL and shows the HTTP status and response time.
- With **Wait for result**, the test then waits for your callback and shows the variables it received.
- You can only activate the webhook once the test (and for **Wait for result** also the callback) succeeded. If you change the URL or mode, test again.

## Verify the signature

Every call carries the headers `x-indeal-signature` and `x-indeal-timestamp`, as with [inDeal webhooks](https://success.indeal.ai/hc/indeal/articles/indeal-webhooks-send-lead-changes). Owners and admins see the signing secret under **Automation (optional)**. If you own the agent without admin rights, ask them for it.

## If nothing comes back

If inDeal cannot reach your URL, it retries three times (after 1, 2 and 4 minutes). If no result arrives within 30 minutes in **Wait for result** mode, or a placeholder is missing, the agent sends nothing and asks you, just like with an unclear reply. A partial or empty message is never sent.

## Regenerate existing drafts

If you set up the webhook while drafts were already open, click **Regenerate** on the card under **Replies**. The agent recognizes the lead's reply again and triggers the webhook as for a new reply, even if it already ran for this lead. With **Wait for result**, the previous text stays until your result arrives; until then **Approve** is locked. If nothing comes back or a placeholder is missing, the draft is created without webhook data and with a notice. Regenerating never sends by itself, not even on autopilot. If you already changed the text, inDeal asks first whether to replace it.

Without a webhook you store the result of a promised service right at the reply, with **Store result** below the draft. With a webhook the card shows **Store manually** in case you want to enter it yourself.
