Skip to main content

Intercom

Intercom is a messenger and help desk for websites and apps. An app in the Developer Hub — made in the interface, without code — subscribes to webhooks: a customer started a conversation, an agent closed it, a ticket was created, changed its state or was closed. Sent to the Flows address, these webhooks start your flows: a conversation is closed — and the customer gets a thank-you in Viber or SMS.

The catch is the phone: Intercom webhooks carry no phone number, only the id of the contact and the email of the author of a conversation. So a message goes only to a person AlphaFlow already knows with a phone.

Written from Intercom documentation

This page is written from the public documentation of Intercom and has not been checked on a live account yet.

What you need​

  • A paid Intercom workspace, or a development workspace.
  • An app in the Developer Hub. The way in from Settings → Integrations is not confirmed by the documentation.
  • A way for AlphaFlow to find the customer: the user_id of the contact from your system (in Intercom it is the external id) or the email. The contact has to be known to AlphaFlow with a phone already, for example from your shop or CRM.

Step 1. Create a connection​

  1. Open Flows → Connections, press Connect a system and choose Intercom.
  2. Press Copy address. It looks like https://events.alphasms.net/hooks/<TOKEN> — keep it secret.

Step 2. Set up webhooks in Intercom​

  1. In the Developer Hub press New app — an internal app of your workspace.
  2. In Authentication give the app the rights Read conversations and Read tickets.
  3. Open Configure → Webhooks. Endpoint URL — the address from the cabinet. Topics — conversation.user.created and conversation.admin.closed; for tickets also ticket.created, ticket.state.updated and ticket.closed. Press Save.
  4. Intercom checks the address with a HEAD request. AlphaFlow accepts any method, so the check passes.

Step 3. Send a test​

Start a conversation from the Messenger as a test user and close it. The events appear in Flows → Connections → Event journal, and the connection shows Recognised: Intercom. If the event has neither an email nor a user_id known to AlphaFlow, it is refused with no_contact — that is expected.

Events​

Intercom topicAlphaFlow eventProperties
conversation.user.created — a customer started a conversationticket_createdconversation_id, topic
conversation.admin.closed — an agent closed the conversationticket_closedconversation_id, topic
ticket.createdticket_createdticket_id, status
ticket.state.updatedticket_status_changed; the state resolved — ticket_closedticket_id, status
ticket.closedticket_closedticket_id, status
ping—taken and skipped
  • status is the state of a ticket: submitted, in_progress, waiting_on_customer, resolved. Only submitted is confirmed by the documentation. Which state becomes ticket_closed is set by a table in the connection, and you can correct it there.

The contact is found only by the email of the author of a conversation and by the external id of the contact — the user_id from your system; leads and visitors have none. Both fields are taken from the Intercom models of conversations and tickets; that webhooks carry them is not confirmed by the documentation. There is no phone. An event with neither an email nor an external id known to AlphaFlow is refused with no_contact; ticket events carry no email.

Support events are not among the events of the ready-made templates (see Recommended events): create the flow From scratch and choose the event as its start.

With the phone: a data connector​

A Data connector step in Intercom Workflows sends a request with a body you write — and the body can carry the phone of the user. Which plans have data connectors is not confirmed by the documentation, nor are the names of the attributes.

  1. Open Settings → Integrations → Data connectors and press + New. HTTP method — POST; URL — the address of the connection; in HTTP headers → Key value pair add Content-Type with the value application/json.
  2. Paste the body below. Insert the values in <…> from the menu of attributes.
  3. Press Test request. It is a real request: an event comes.
  4. Switch the Fin tab of the connector to Disabled — then the connector is available in Workflows.
  5. In Fin AI Agent → Workflows open the workflow you need (for example, on a new conversation), press + Add step, choose Data connector (using API) and this connector, and set the branches of success and failure.
{
"event": "ticket_created",
"contact": {
"phone": "<User → Phone>",
"email": "<User → Email>",
"external_id": "<User → User ID>"
},
"traits": { "first_name": "<User → First name>" },
"properties": { "conversation_id": "<Conversation → ID>" },
"context": { "source": "intercom" }
}

event is fixed in the body, so make one connector per event. Series Webhook steps do not fit: they send only flat pairs of keys and values and cannot build this body.

Good to know​

  • Intercom waits 5 seconds for the answer. Without an answer, or after a 4xx or 5xx, it repeats once in a minute. The Flows address answers 200 at once, so there is nothing to repeat.
  • Intercom signs every webhook (X-Hub-Signature). Checking the signature is optional: the secret in the address is enough.
  • The address always answers 200. Above the daily event limit the event is refused in AlphaFlow with quota_exceeded and shown in the journal; the subscription of the app stays on.

Intercom documentation​