INTERCOM_WEBHOOK_TOPICS is the same tuple IntercomChatbot uses in the event connector for session-link webhooks, so what you subscribe to in Intercom stays aligned with parsing and linking.
intercom_chatbot_webhook_url builds the correct /chatbot-webhook/{product_id} URL and rejects invalid product_ids; format_reactive_session_link_script matches optional POST /sessions/link when you still need browser-side linking.
Module: autoplay_sdk.integrations.intercom
Small, dependency-light helpers in autoplay_sdk/integrations/intercom.py for Developer Hub URL/topics and the reactive snippet.
Webhook topics
Subscribe in Intercom to exactly these topics so session linking and chatbot delivery stay aligned withIntercomChatbot parsing in the connector:
| Name | Constant | Value |
|---|---|---|
| User created | INTERCOM_WEBHOOK_TOPIC_USER_CREATED | conversation.user.created |
| User replied | INTERCOM_WEBHOOK_TOPIC_USER_REPLIED | conversation.user.replied |
INTERCOM_WEBHOOK_TOPICS — both strings above. Other topics are ignored by the connector.
intercom_chatbot_webhook_url(connector_host, product_id) -> str
Builds the absolute HTTPS URL for Intercom outbound webhooks:
{origin}/chatbot-webhook/{product_id}
connector_host: hostname (event-connector-xxxx.onrender.com) or full origin (https://…). Trailing slashes stripped; bare host getshttps://prepended.product_id: non-empty, no/(single path segment).
ValueError if host or product id is invalid.
format_reactive_session_link_script(connector_host, product_id) -> str
Returns an HTML/JS snippet that registers Intercom("onConversationStarted", …) and POSTs to /sessions/link with product_id, PostHog session_id, and conversation_id.
Use only when you still need browser-side linking; prefer webhooks to /chatbot-webhook/{product_id} first.
Connector endpoints (reference)
| HTTP | Role |
|---|---|
POST /chatbot-webhook/{product_id} | Primary path: Intercom signed webhooks for conversation.user.created / conversation.user.replied. |
POST /sessions/link | Optional: JSON body links session ↔ conversation (reactive snippet). |
X-Hub-Signature-256 and your app client secret in product config.
Delivery stack in this repo
BaseChatbotWriter(Chatbot writer) — pre-link buffer, post-link debounce, shared note body format (format_chatbot_note_header, numbered action lines, binning).IntercomChatbot(event connectorflows/chatbot/intercom.py) — subclass; implements Intercom REST admin notes (_post_note,_redact_part) and webhook payload parsing for linking.
AsyncAgentContextWriter as described on the chatbot-writer page.
Related
- Chatbot writer —
BaseChatbotWritercontract and note format. - Agent context — summariser +
overwrite_with_summaryflow.