intercom / intercom-node

Node.js bindings for the Intercom API
https://developers.intercom.com
Other
366 stars 116 forks source link

Unable to pass customAttribute object to client.conversation.update() #349

Closed dlesky closed 1 year ago

dlesky commented 1 year ago

Please use the following template to submit your issue. Following this template will allow us to quickly investigate and help you with your issue. Please be aware that issues which do not conform to this template may be closed.

For feature requests please contact us at team@intercom.io

Version info

Expected behavior

per https://developers.intercom.com/intercom-api-reference/reference/update-a-conversation https://github.com/intercom/intercom-node#update-a-conversation

(async function wrapper() {
  const response = await intercomClient.conversations.update({
    id: 68,
    markRead: true,
    customAttributes: {
      anything: 'you want',
    },
  });
  console.log(response);
}());

I expected the custom_attribute field to be updated.

Actual behavior

I get the following error:

    errors: [
      {
        code: 'parameter_invalid',
        message: "Conversation attribute 'anything' does not exist"
      }
    ]

Steps to reproduce

(async function wrapper() {
  const response = await intercomClient.conversations.update({
    id: 68,
    markRead: true,
    customAttributes: {
      anything: 'you want',
    },
  });
  console.log(response);
}());

Logs

    errors: [
      {
        code: 'parameter_invalid',
        message: "Conversation attribute 'anything' does not exist"
      }
    ]

Thank you!

suma-prakash commented 1 year ago

Hi, the conversation update endpoint will add the custom attribute to the conversation only if the custom attribute exists. If it doesn't, then it will throw an error. Please try this with an existing attribute and do get back to us if you face any issues. Also, a new custom attribute can be created by using the data attributes endpoint. You can try it out here- https://developers.intercom.com/intercom-api-reference/reference/createdataattribute