I am using the @intercom/messenger-js-sdk SDK.
It successfully records new users.
The problem is that I cannot find how to set custom attributes for that user. I have the custom attribute `is_admin`.
Here are the approaches I’ve tried:
- Basic object
Intercom({
app_id: APP_ID,
api_base: process.env.NEXT_PUBLIC_INTERCOM_API_BASE_URL,
user_id: user.id,
email: user.email,
user_hash: hash,
is_admin: user.role.includes('admin'),
});
- Object with custom_attributes
Intercom({
app_id: APP_ID,
api_base: process.env.NEXT_PUBLIC_INTERCOM_API_BASE_URL,
user_id: user.id,
email: user.email,
user_hash: hash,
custom_attributes: {
is_admin: user.role.includes('admin'),
}
});
- Post instance update method
Intercom({
app_id: APP_ID,
api_base: process.env.NEXT_PUBLIC_INTERCOM_API_BASE_URL,
user_id: user.id,
email: user.email,
user_hash: hash,
});
update({
user_id: user.id,
email: user.email,
is_admin: user.role.includes('admin'),
});
None of these approaches work. `is_admin` is always unknown.
Please let me know the correct approach for uploading custom attributes via the SDK or point me towards the correct documentation (I’ve found all 3 of the above approaches in various parts of the documentation - none of which are working).
Thanks