Skip to main content
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 with IntercomChatbot parsing in the connector:
NameConstantValue
User createdINTERCOM_WEBHOOK_TOPIC_USER_CREATEDconversation.user.created
User repliedINTERCOM_WEBHOOK_TOPIC_USER_REPLIEDconversation.user.replied
Tuple for loops / UI: 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 gets https:// prepended.
  • product_id: non-empty, no / (single path segment).
Raises ValueError if host or product id is invalid. 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)

HTTPRole
POST /chatbot-webhook/{product_id}Primary path: Intercom signed webhooks for conversation.user.created / conversation.user.replied.
POST /sessions/linkOptional: JSON body links session ↔ conversation (reactive snippet).
Webhook verification uses Intercom 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 connector flows/chatbot/intercom.py) — subclass; implements Intercom REST admin notes (_post_note, _redact_part) and webhook payload parsing for linking.
For LLM summaries and redaction ordering, pair with AsyncAgentContextWriter as described on the chatbot-writer page.