Skip to main content
The Intercom plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see Overview for setup context and the exact URL shape).
New to Corsair? See webhooks and hooks.

Webhook map

  • contacts
    • created (contacts.created)
    • deleted (contacts.deleted)
    • tagCreated (contacts.tagCreated)
  • conversations
    • assigned (conversations.assigned)
    • closed (conversations.closed)
    • created (conversations.created)
  • ping (ping)

HTTP handler setup

app/api/webhook/route.ts
import { processWebhook } from "corsair";
import { corsair } from "@/server/corsair";

export async function POST(request: Request) {
    const headers = Object.fromEntries(request.headers);
    const body = await request.json();
    const result = await processWebhook(corsair, headers, body);
    return result.response;
}

Events

Contacts

Created

contacts.created A new contact was created in Intercom Payload
NameTypeRequiredDescription
typestringYes
topicstringYes
idstringNo
app_idstringYes
created_atnumberYes
first_sent_atnumberNo
dataobjectYes
{
  type?: string,
  item: {
  }
}
{
  id: string,
  email?: string,
  name?: string,
  role?: string,
  created_at?: number
}
webhookHooks example
intercom({
    webhookHooks: {
        contacts: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Deleted

contacts.deleted A contact was deleted from Intercom Payload
NameTypeRequiredDescription
typestringYes
topicstringYes
idstringNo
app_idstringYes
created_atnumberYes
first_sent_atnumberNo
dataobjectYes
{
  type?: string,
  item: {
  }
}
{
  id: string,
  deleted?: boolean
}
webhookHooks example
intercom({
    webhookHooks: {
        contacts: {
            deleted: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Tag Created

contacts.tagCreated A tag was added to a contact Payload
NameTypeRequiredDescription
typestringYes
topicstringYes
idstringNo
app_idstringYes
created_atnumberYes
first_sent_atnumberNo
dataobjectYes
{
  type?: string,
  item: {
  }
}
{
  id: string,
  tag_id?: string,
  contact_id?: string
}
webhookHooks example
intercom({
    webhookHooks: {
        contacts: {
            tagCreated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Conversations

Assigned

conversations.assigned A conversation was assigned to an admin or team Payload
NameTypeRequiredDescription
typestringYes
topicstringYes
idstringNo
app_idstringYes
created_atnumberYes
first_sent_atnumberNo
dataobjectYes
{
  type?: string,
  item: {
  }
}
{
  id: string,
  assignee?: {
    type?: string,
    id?: number | null
  }
}
webhookHooks example
intercom({
    webhookHooks: {
        conversations: {
            assigned: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Closed

conversations.closed A conversation was closed Payload
NameTypeRequiredDescription
typestringYes
topicstringYes
idstringNo
app_idstringYes
created_atnumberYes
first_sent_atnumberNo
dataobjectYes
{
  type?: string,
  item: {
  }
}
{
  id: string,
  state?: string
}
webhookHooks example
intercom({
    webhookHooks: {
        conversations: {
            closed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Created

conversations.created A new conversation was created Payload
NameTypeRequiredDescription
typestringYes
topicstringYes
idstringNo
app_idstringYes
created_atnumberYes
first_sent_atnumberNo
dataobjectYes
{
  type?: string,
  item: {
  }
}
{
  id: string,
  created_at?: number,
  state?: string
}
webhookHooks example
intercom({
    webhookHooks: {
        conversations: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Ping

Ping

ping Initial ping sent by Intercom when a webhook URL is first registered Payload
NameTypeRequiredDescription
typestringYes
topicstringYes
idstringNo
app_idstringYes
created_atnumberYes
first_sent_atnumberNo
dataobjectYes
{
  type?: string,
  item: {
  }
}
{
  type: ping,
  message: string
}
webhookHooks example
intercom({
    webhookHooks: {
        ping: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})