JavaScript API: creating attributes

I know I can send “name” and “email” as attributes using the .setAttributes() method of the JavaScript API.
However, I tried sending “phone,” but when viewing the chat as an agent, the “Phone” attribute is not populated with the value I sent using the JavaScript API.
How can I send additional attributes, such as phone number, user ID (an ID from my application), device configurations, and others?

1 Like

Hi @tainass ,

The phone attribute is not currently mapped to a dedicated field in the agent interface. While you can send it using .setAttributes(), it won’t populate the “Phone” field. Support for this is already in our pipeline, and we’ll keep you posted on updates.

Custom attributes will appear in the visitor details panel during a chat and can help provide more context for your team. You can find the JavaScript API reference for the setAttributes function here: JavaScript API – tawk.to Developer Portal

Let me know if you have any other questions in the meantime.