I am using the official Intercom node.js 'intercom-client' library (latest version -- 4.0, and node version 16.18) to try to add data to the custom_attribute
field for an existing conversation, but keep getting an 'attribute does not exist' error.
According to the Intercom API documentation, it is possible to modify the custom_attribute field of a conversation: https://github.com/intercom/intercom-node#update-a-conversation https://developers.intercom.com/intercom-api-sreference/reference/update-a-conversation
Using the node.js 'intercom-client' library to interact with the API in javascript, I attempted the following:
Passing the following object: { test: 'hope' };
to the client.conversations.update()
method using the following code:
const customAttributes = { test: 'hope' };
client.conversations.update({
id: '68',
customAttributes,
});
I get the following error:
errors: [
{
code: 'parameter_invalid',
message: "Conversation attribute 'test' does not exist"
}
]
I would have expected it to modify the conversation object successfully.
Per the official documentation on the git-hub repo, the following should work:
const response = await client.conversations.update({
id,
markRead: true,
customAttributes: {
anything: 'you want',
},
});
but I get the same error, when I use this code exactly as it is written. I have tried to use snake case for the 'customAttributes' field, i.e. tried 'custom_attributes' without success. I have also tried to pass this object to the conversation at time it is created (using client.conversation.create()), given that the error is suggesting that the object should have been passed earlier, but without success (nothing happens...).
Thank you for your help! Dan