We expose some functions in the Frontend to programmtically control the Chat window.


Opens the chat window. Useful for programmatically triggering the chat window from an explicit support flow or button on your site.


Closes the chat window.


Pass in a callback function that is called immediately and when the unread message count changes. If you pass in null as the callback function, the existing callback is removed.

window.Pylon("onChangeUnreadMessagesCount", function (unreadCount) {
  console.log("unread changed!", unreadCount);


Pass in an object of custom field slugs to their values. New issues created through the chat will have these custom fields values set.

You must first create the corresponding custom fields inside of Pylon.


window.Pylon("setNewIssueCustomFields", { user_id: "abc123" });

You can find the slug value on the custom fields page next to the custom field.