Skip to main content
Using Custom Objects in Workflows

Create fully flexible and powerful support experiences in your Workflows and Custom Answers with Custom Objects.

Beth-Ann Sher avatar
Written by Beth-Ann Sher
Updated over a month ago

With the added flexibility of storing data in Custom Objects, your customers can automatically be shown information such as recent orders they’ve made, and they’ll be able to select from this object data and even take actions on it such as canceling an order.

1. Create a Custom Object

First, head over to Custom object data in your settings and create a new Custom Object with any fields you require - like price, rating, etc.

2. Create references to people and conversations

Next, head over to your Conversation data in your settings and create a new reference from conversation to your object - in this example, we called our object Order. Here, turn on the "Allow referencing multiple Orders" toggle as one conversation can have multiple orders that it references. Learn more about setting up references with Custom Objects

Then, go to People data and create a new reference to your Orders object. Here also, turn on the "Allow referencing multiple Orders" toggle as one person can have multiple orders that they placed.

3. Set up a Custom Action

The next step is to set up your Custom Action that will fetch the data and store it into the Order object.

When setting up your action, select the references we created in step 2 in the Update references from People or Conversations to Order section of the Response set up:

4. Set up your Workflow

Head over to AI and Automation > Workflows and click + New workflow.

Create a Workflow from scratch and choose a trigger such as "Customer opens a new conversation in the Messenger".

Finish setting up the trigger rules and then click Save and close to start building your Workflow. Now you can customize the welcome path and reply buttons.

For example, from a reply button you could add a path which allows the user to see their orders. In this path, click on the + button and choose Custom Action (using API).

From the dropdown, choose your Custom Action and then add a fail path to give users some context in case your Custom Action fails to complete.

Then, click on the + button again and this time, choose Buttons from Custom Objects.

Adding buttons from Custom Objects will present you with the following fields to complete:

  • Select data...

  • None of the above

  • Save selection to...

Click on Select data and in the draw, select:

  • From - the object you want to display buttons for, in our case Orders.

  • Where - reference attribute to conversation or people, in our case it's "Orders in conversation for Conversation from context". This will display each instance of the object associated with the current conversation.

  • Number of buttons - this limits the number of items which will be retrieved (maximum 25).

  • What the buttons should show - for this example, we want to display the name of an item that has been ordered.

Next, click on Save selection to and then + Link Conversation to Order.

This will bring you back to Conversation data where you can click + Create attribute and create a new reference to the Order object that will store the selected selection from your Workflow.

Make sure that "Allow referencing multiple Orders" toggle is turned off as this reference will only store a single (selected) object from the Workflow.

Now go back to your Workflow tab and Save changes then refresh the page to pick the newly created reference attribute:

Note: Each of these replies represents a Custom Object Instance, the replies are ordered by that Custom Object Instance's external_updated_at value.

The most recent external_updated_at value will be at the top of the list and the oldest external_updated_at value will be at the bottom of the list (closest to "None of the above").

You will need to set the external_updated_at value for each instance according to how you want them ordered.

5. Display data from Custom Object to your user

When the user selects an order, this will save their selection to the Selected order reference and you can display data from that object directly in your Workflow messages.

To do that, add a path from the Select data button (Orders > Item_name in this example). Then, you can click on the attribute selector {..} button and choose the appropriate attribute you want to show.

Tip: If you have multiple Custom Object references, you can make sure to pick the correct one by looking at the heading in the attribute selector - for example above, we're picking Conversation > Selected order (order) reference:

And that's it! Set your Workflow live and you're good to go 🎉

Viewing Custom Object instance data in the Inbox

Once your users start interacting with your Workflow, you'll want to see what orders did the Custom Action return for their request and what order did they pick.

You can do that by looking the conversation details sidebar. In this example. all fetched orders for the conversation will appear under the "Orders for Conversation" reference attribute and the selected order is stored under "Selected Order":

You can read more about Custom object data in the Inbox here.


💡Tip

Need more help? Get support from our Community Forum
Find answers and get help from Intercom Support and Community Experts


Did this answer your question?