Answered

How do I get the context/lead information in my custom intercom app

  • 8 November 2021
  • 1 reply
  • 60 views

Hi, I have been trying to create our own intercom that interfaces to our own internal api to provide user details and properties. But how do I get the information around the context/lead in the initialize request. I have been trying to follow the tutorial and understand how I display components in the Canvas Kit, but how can I understand the context/lead of the user that is access when this app is shown in the conversation window?

icon

Best answer by Bastien 9 November 2021, 10:15

View original

1 reply

Hi @thomas n13​,

 

When you provide a URL served by your app, Intercom will call it with a POST method:

config_urlThey provide the context with their POST request. In an app for Users, here is an example of data posted by Intercom to an Initialize flow webhook URL:

{
"workspace_id": "XXXXXXX",
"context": {
"conversation_id": XXXXXXXXXXXX,
"locale": "en",
"location": "conversation",
"messenger_action_color": "#333333",
"messenger_background_color": "#333333"
},
"admin": {
"type": "admin",
"id": "XXXXXXX",
"name": "XXXXXXXXXXXX (my name)",
"email": "my_name@domain.com",
"away_mode_enabled": false,
"away_mode_reassign": false,
"has_inbox_seat": true,
"avatar": {
"image_url": "https://static.intercomassets.com/avatars/XXXXXXXXXXXXquot;
},
"team_ids": []
}
}

In an app for Teammates, here is an example of data posted by Intercom to an Initialize flow webhook URL:

{
"workspace_id": "XXXXXXX",
"admin": {
"type": "admin",
"id": "XXXXXXX",
"name": "XXXXXXXXXXXX (my name)",
"email": "my_name@domain.com",
"away_mode_enabled": false,
"away_mode_reassign": false,
"has_inbox_seat": true,
"avatar": {
"image_url": "https://static.intercomassets.com/avatars/XXXXXXXXXXXXquot;
},
"team_ids": []
},
"conversation": {
"type": "conversation",
"id": "XXXXXXXXXXXXXXXXXXX",
"created_at": 1633532241,
"updated_at": 1636364551,
"waiting_since": null,
"snoozed_until": null,
"source": {
"type": "conversation",
"id": "XXXXXXXX",
"delivered_as": "customer_initiated",
"subject": "",
"body": "\u003cp\u003eHello!\u003c/p\u003e",
"author": {
"type": "user",
"id": "XXXXXXXXXXXXXXXXXXXX",
"name": "XXXXXXXXXXXX (customer's name)",
"email": "my_customer@domain.com"
},
"attachments": [],
"url": "XXXXXXXXXXXX",
"redacted": false
},
"contacts": {
"type": "contact.list",
"contacts": [{ "type": "contact", "id": "XXXXXXXXXXXXXXXXXXXX" }]
},
[...]
}
}

More about this here: https://developers.intercom.com/building-apps/docs/canvas-kit#section-requests-responses/p>

 

Hope this helps!

Reply