Hey there! Ebenezer here from Engineering Support.
We get a lot of questions on how to “Pass a Company ID over in a Conversation”. While Company data doesn't get stored in the Conversation Object, there is a way to do this!
First, you'll need to create a Conversation Data Attribute that stores the specific value that you're looking to access.
Next, Your team will need to perform several calls to our REST API to get the ball rolling. Initially, they would Retrieve a conversation and then locate the value for source.author.id
. This value will contain the ID of the person who initiated the conversation.
A little side note; You’ll want to verify that the source.author.type
is "user" for those conversations. If it's "admin" then that ID will be for a team member on your workspace who started the conversation. In these situations, you will want to dig into the conversation_parts
attribute to see who the actual customer is.
Once you have the ID of the User, you will then want to make a call to the /contacts endpoint and make a "Get a contact" call using that ID. That Contact Object contains a companies
attribute that contains an array of all the companies that your user is associated with. From there, they can find the id
attribute of the company.
Now that you have the company ID, you can make an update call to the conversation object and update the custom_attribute
with the value of that company ID.
TADAA