Hello everyone, I am working in a custom integration with Intercom that will allow my customers to create bots that handle e-commerce tasks for them directly in the Messenger. To do that we want to allow them to build a bot that:
- Collects some data like email and order number
- Calls my API endpoint
- Allows the customer to select what order line they want to talk to support about
To do this I have created 2 custom objects:
_customOrders, with the fields:
- externalID
- customer_email
- customer (many to 1 People with the field name custom_orders)
- conversation (many to 1 Conversation with the field name custom_orders)
- custom_lines (1 to many _customLines with the field custom_order)
_customLines, with the fields:
- externalID
- price
- product_name
- custom_order (many to 1 _customOrders with the field custom_lines)
- conversation (many to 1 Conversation with the field custom_lines)
- customer (many to 1 People with the field custom_lines)
Based on the documentation I then created a custom action that returns a JSON like this:
{
"id": 1,
"order_number": 1001,
"customer_email": "someone@example.com",
"lines": t
{
"id": "p1",
"price": 10,
"product_name": "product name 1",
"order_id": 1001
},
{
"id": "p2",
"price": 11,
"product_name": "product name 2",
"order_id": 1001
}
]
}
And I mapped it so that:
_customOrders will take the root and map externalID to id, customer_email to customer_email. I then added a mapping to Conversation + People from the context.
_customLines will take the "lines" array and map externalId to id, price to price, and product_name to product_name. I then also mapped to Conversation + People from the context.
However when I try to use these in a custom bot by adding the Custom Action (using API) they won't work even though it shows it will update the Conversation and People:
If I add then a Reply buttons from Custom Objects action in the success path of this action I can choose the custom object data from the API response correctly, either I use the _customOrders or the _customLines one. But each give me the same error when trying to save the selection to the conversation: "Link Conversation to <custom_object_selected>". But they are already linked, so this is really confusing.
For reference I tried removing that mapping in the custom action to save it to People + Conversation through the context and it still failed. So I am at a loss of why this doesn't work.