Question

How can we clear out custom object data from people data?

  • 29 December 2022
  • 7 replies
  • 139 views

I'm building a custom bot that automates order refunds. I have set up a custom action that gets recent orders and puts them into the order custom object that maps to people data. This works fine.

 

The issue is that when I show reply buttons from object data in the bot flow, I am never able to change what orders are shown after the initial 5 are shown. Once the person has orders in their custom object data, those are the orders that are always shown, regardless of what orders were fetched by the custom action.

 

What I expect to happen is that the orders shown are the same as the ones fetched by the custom action.

 

I have already verified that external_id is mapped correctly so that there are no duplicates.

 

I have also tried to map orders to conversation data and NOT people data in order to force refresh the orders when a new conversation has started but that does not work. It seems that the orders must be stored on people data in order to use in the bot workflows.

 

For additional context, I have already read every help center article on custom actions and custom objects. I have also found a similar forum question on here where someone is having the same issue.

 

It seems like there may be an issue with the custom actions and objects system where an array of custom objects sticks with people data forever and cannot be cleared out.


7 replies

Userlevel 4
Badge +5

Hey @user1539​ Racheal from the support engineer team here👋 

 

In order to use a Custom Object in a Custom Bot there must be a relationship to both People and Conversation. You will need a Many:1 relationship from Order to People (we'll call this user_for_glitch_order in my example) and a 1:Many relationship for Order to Conversation. You should be mapping your attributes from your Order Object. In your data selection buttons you will want to create a button for each item in your custom object:

Screen Shot 2022-06-15 at 11.14.06Custom Objects and Actions can be a bit tricky to troubleshoot, especially without seeing the specifics. If you are still running into trouble feel free to write into support via the Messenger or team@intercom.io!

Did you even read @user1539​ 's question? You didn't answer it at all.

@user1539​ I'm encountering the same issue. I've tried reassigning the order collection to a different one, reassigning the order collection to an empty array, issuing a delete request using the order record I want to clear out. None of them remove orders that have already been associated with a user.

 

This is super frustrating and makes this complex feature basically worthless

@Lena Leadbetter​ Could you please help us out with this? I see you were the main PM on this feature

@david g13​ I ended up with a workaround that you may be able to use until intercom has a solution for this. What I ended up doing was controlling what orders showed by setting the external_created_at value to be the current time (coming from the backend). The orders that will be shown are the 5 most recent sorted by that external_created_at field. I send a field called intercomTimestamp from my backend and set that to the external_created_at field. That timestamp is just the current server time so its always going to show that last 5 orders fetched in the custom action.

Screenshot 2023-01-25 at 2.57.23 PM

But basically you can control what orders are shown by that external_created_at field. Crappy that we have to do a workaround like this but depending on how much you need to roll an implementation out the door this may be as helpful to you as it was to me.

Hi @user1539​ @david g13​ I'm Brian, the PM at Intercom working on Custom Objects.

Thanks for the feedback - firstly, we absolutely hear you on this one and it's something our team has heard from our customers several times since our initial V1 of the Custom Objects capability last June. Our journey here with Custom Objects is still relatively early and we're keen to learn about how we can add use cases, improve the capability over time.

 

re the issue: What I expect to happen is that the orders shown are the same as the ones fetched by the custom action

While it's a little bit of a "workaround"; if you relate the Custom Object "Order" to the Conversation object (rather than the User Object), then this should give you the expected behaviour (note we have a hard limit currently of 5 custom objects ordered by last updated).

 

Why does this work: This works because conversations are essentially ephemeral i.e. an End User will create a new conversation with each inbound request to refund an order. Thus it'll be a new Custom Action request that is triggered and only the Orders returned from that call will be related to the Conversation. Whereas when related to the User; the Orders are appended to any other Orders that might already be related to the User (e.g. from a prior refund conversation) and thus it will show the last 5 orders irrespective (helps to map the datetime field here to ensure the right sorting) as to whether they were returned in the most recent custom action response request or not.

 

Hope this helps - any questions feel free to add in the thread.

 

Brian

 

 

 

Reply