# Start a workflow from Intercom events

> Run a workflow when Intercom reports a new conversation, a reply, a new contact, or a ticket, with a Webhook block set to Intercom.

To run a workflow when Intercom reports a new conversation, a reply, a new contact, or a ticket, add a **Webhook** block whose **Source** is **Intercom** and give its URL to your Intercom app's webhook settings. Intercom posts one notification per request. Each notification starts its own run.

You need an Intercom app whose settings you can open in Intercom's Developer Hub, edit access to the workflow's project, and the member role or higher in the workspace to save the app's secret on a connection. The Intercom steps happen in the Developer Hub.

## Add the Webhook block and generate its URL

1. In a draft workflow, add a **Webhook** block. The block palette also lists **Intercom webhook** in the **Start** group, which adds the block with its source already set.
2. Under **Source**, choose **Intercom**. The line under the setting reads "Verifies the signature · one run per event · skips duplicates".
3. Under **Webhook URL**, select **Generate URL**, then copy the URL.

The badge beside the URL reads "Runs start after publish". The URL contains a token, and anyone who has the URL can send requests to it. Keep it out of shared documents.

## Give the URL to your Intercom app

1. In the Developer Hub, open your app. Under **Configure**, select **Webhooks**.
2. Paste the URL you copied as the endpoint URL.
3. Choose the topics you want from the list of webhook topics, and select **Save**. A topic is Intercom's name for an event type, such as `conversation.user.created`.

Intercom checks the URL before it accepts it. The block answers the check itself, also while the workflow is a draft. **Recent deliveries** lists the check as **Handshake** with "Intercom checked that the URL answers.", and the last line under **Set up** reads the same. It starts no run.

Intercom also sends a notification with the topic `ping` when the webhook is saved, and again from time to time. A ping that carries no signature is listed as **Handshake** with the same sentence. A ping that carries one is listed as **Ping** with "A ping from the sender, not an event. Nothing ran." No ping starts a run.

The Webhook block offers these Intercom topics: `conversation.user.created`, `conversation.user.replied`, `conversation.admin.replied`, `conversation.admin.assigned`, `conversation.admin.closed`, `contact.user.created`, `contact.lead.created`, `contact.deleted`, `ticket.created`, `ticket.state.updated`, and `company.created`.

## Save the Client secret on a connection

Intercom signs each notification with the app's **Client secret**. That secret is the same for every webhook of the app, so OutWin does not save it on the block. You save it once on an API connection, and each Webhook block that receives from the app chooses that connection.

1. In the Developer Hub, open the app's **Basic Info** page and copy the client secret.
2. In OutWin, open **Connections**. If the workspace has no API connection for Intercom, [add one](https://outwin.ai/docs/build/connect-an-api/#add-an-api-connection). In the dialog, leave **Base URL** empty and set **Authentication** to **None**. The connection then only receives events. If your workflows also call the Intercom API, enter its base URL and credential instead, or add them later on the connection's page. This guide does not need them.
3. On the connection's page, under **Receiving events**, paste the secret into the field that shows "Paste the signing secret" and select **Save**. The section then shows only a masked hint and the saved date, with **Replace** and **Remove**.
4. In the block's settings, under **Connection that holds the client secret**, choose the connection. Each connection in the list is marked "secret saved" or "no secret yet".

The line under the setting then starts "Verifying with the secret ending", followed by the hint. Under **Set up**, the second line changes to "The client secret is saved: deliveries are verified."

In a workspace with no API connection, the setting shows "No API connections yet." in place of the list, with an **Add one** link that opens **Connections**. If you choose a connection that has no secret, the line reads "This connection has no client secret yet." with a **Save it on the connection** link to its page.

A second Webhook block for the same app chooses the same connection. Removing the secret from the connection stops verification for every block that chose it.

With no connection chosen, or with a connection that has no secret, the block still starts runs, and nothing is verified: anyone who has the URL can start the workflow. Publishing then shows a warning that ends "has no signing secret saved, so its deliveries are not verified: anyone who has this URL can start this workflow". The warning does not block publishing.

## Choose which events start a run

Under **Events that start a run**, tick the topics that start a run. With none ticked, every notification Intercom sends starts a run, except a ping. To start runs for a topic that is not listed, type it into the box under the list and select **Add**.

A notification whose topic is not ticked is listed as **Filtered out** and starts no run. To narrow further by a field of the notification, add a row under **Only when**. Intercom puts the conversation, contact, ticket, or company under `data.item`, so a field of it has a path that starts with `body.data.item`, such as `body.data.item.id`. [Webhook settings](https://outwin.ai/docs/reference/triggers-approvals-and-waits/#webhook-settings) lists the comparisons.

## Send a test and check what arrived

1. In Intercom, do something that causes one of the subscribed topics, such as starting a conversation as a test contact.
2. In OutWin, look under **Recent deliveries** in the block's settings.

**Recent deliveries** lists every notification that reached the URL, including while the workflow is a draft. On a draft each notification is listed as **Dropped** with "The workflow is not published, so nothing ran." It starts no run and is not run later. The last line under **Set up** changes from "Intercom checked that the URL answers." to, for example, "Received conversation.user.created. Dropped."

With a secret saved on the chosen connection, a notification listed as **Dropped** on a draft has passed the signature check. A delivery that fails the check is listed as **Refused**.

If you have edit access, select a notification to see what the block passed on. The list is kept for seven days, and the data of the newest 20 events is kept.

## Read the event in the next block

Each run receives one Intercom notification. Intercom wraps the object the notification is about: the body holds the notification's own fields, and the conversation, contact, ticket, or company is two levels down, at `body.data.item`. An HTTP request block or a database block directly after the Webhook block reads it with these expressions. An AI block such as **Think** receives the whole value as its input.

| Expression | What it holds |
| --- | --- |
| `{{input.body}}` | The notification as Intercom sent it, with fields such as `type`, `topic`, `id`, `created_at`, and `data`. |
| `{{input.body.data.item}}` | The object the notification is about. Its fields depend on the topic. |
| `{{input.body.data.item.id}}` | One field of that object. Read any other field the same way. |
| `{{input.event.type}}` | The topic, such as `conversation.user.created`. It is the notification's `topic` field. The body's `type` field is `notification_event` for every notification. |
| `{{input.event.id}}` | The notification's id. It is the notification's `id` field. |
| `{{input.event.time}}` | The notification's time as an ISO 8601 date and time. `{{input.body.created_at}}` holds the same moment as Intercom sent it, in seconds. |
| `{{input.delivery.verified}}` | `true` only when the signature was checked and passed. |

A block further along reads the same values through the Webhook block's name, as in `{{steps["Intercom"].body.data.item.id}}` for a block named `Intercom`. [Data and context](https://outwin.ai/docs/reference/data-and-context/) describes what each block passes on.

## Publish and check the runs

[Publish the workflow](https://outwin.ai/docs/run/publish-and-start/). From then on, each notification that passes the filter starts a run. On a published workflow the block's settings are read-only, including the choice of connection, and **Recent deliveries** is in the block's inspector. You can still replace the secret on the connection's page.

| Outcome | What happened |
| --- | --- |
| **Ran** | The notification started a run. |
| **Waiting** | 10 runs of the workflow are already active. The notification starts a run when one of them ends. A notification that waits longer than an hour is listed as **Dropped**. |
| **Duplicate** | A notification with the same `id` already ran in the last 72 hours. The line reads "This event was already received and run, so it did not run again." |
| **Handshake** | Intercom's check of the URL, or a ping that carried no signature. It starts no run. |
| **Ping** | A ping that carried a signature. It starts no run. |

Runs start in the order notifications arrive. That is not always the order things happened, so do not build a workflow that relies on `conversation.user.created` arriving before `conversation.user.replied`.

Receiving a notification costs no credits, and neither does one that is filtered out, a duplicate, a handshake, or a ping. A run that starts uses credits for the blocks that run in it.

## If nothing runs

Open **Recent deliveries** and read the outcome and the sentence beside the newest notification.

| What you see | Cause | Fix |
| --- | --- | --- |
| "Nothing has arrived yet." | No request has reached the URL, not even Intercom's check. | Check that the endpoint URL in the app's webhook settings is the block's current URL. **Rotate token** on a published workflow changes the URL, and the old one stops working. |
| **Handshake** or **Ping** and nothing else | Intercom accepted the URL, and no subscribed topic has happened since. | Check that the app is subscribed to the topic you caused, and cause it again. |
| **Dropped** with "The workflow is not published, so nothing ran." | The workflow is a draft. | Publish the workflow. Notifications that arrived before then are not run later. |
| **Dropped** with "The workflow is paused, so nothing ran." | The workflow is paused. | Resume the workflow. Notifications that arrived while it was paused are not run later. |
| **Filtered out** with `Events of type "contact.deleted" are not chosen on this trigger.` | The notification's topic is not ticked under **Events that start a run**. | Tick the topic, or clear every tick so that all notifications start a run. The settings are read-only on a published workflow. |
| **Refused** with "The signature did not match. Check that the secret saved here is the one the sender shows for this URL." | The secret on the chosen connection is not the **Client secret** of the app that sends the notifications. This can happen when the block chose another service's connection, when the secret was copied from another app, or when the app's secret was replaced in Intercom. | Copy the client secret from the app again and select **Replace** under **Receiving events** on the connection's page. You do not republish the workflow. |
| **Refused** with "The request carried no signature." | A secret is saved on the chosen connection, and the request did not carry Intercom's signature. A request sent by hand to try the URL has none. | Cause the event in Intercom so that Intercom sends the request. |

A delivery listed as **Refused** is answered with status `401` and starts nothing. OutWin keeps none of its data. For every other outcome in the table, Intercom receives a success response and OutWin does not run the event later.
