API Returns Cannot submit an array as a custom attribute value | Community
Skip to main content

Hello,

 

We created a custom attribute with the list type called `Channel Networks`. When we try to update it via the API we get back the following error:

```

{
  type: 'error.list',
  request_id: 'REDACTED',
  errors: r
    {
      code: 'nested_custom_attributes',
      message: 'Cannot submit an array as a custom attribute value'
    }
  ]
}

```

Other custom attributes work fine, just list/array type ones fail.

```

const respIntercom = await fetch(

`https://api.intercom.io/contacts/${contact_id}`,

{

method: 'PUT',

headers: {

'Content-Type': 'application/json',

'Intercom-Version': '2.12',

Authorization: `Bearer ${process.env.INTERCOM_ACCESS_TOKEN}`

},

body: JSON.stringify({

"name": userData.user.name + " TEST",

"phone": userData.user.phone,

"last_seen_at": userData.user.last_online,

"signed_up_at": userData.user.created_at,

"custom_attributes": {

"ACME": userData.user.acme,

"Channel Networks": n"Channel 1", "Channel 2"],

}

})

}

);

```

Hey ​@paulmwatson 👋 Jacques here from Intercom Support. I hope all is well today!

This issue is due to the fact that the Intercom API does not support updating custom attributes of the list type with an array. This is a known limitation, as the API can create or edit list-type custom attributes but does not allow updating them with an array of values. Instead, you need to use the list item ID to select the option, and only one option can be selected at a time.

Hope this is clear!