Recent searches


No recent searches

Way to tell if a chat has been initiated?



Posted Oct 31, 2022

We have a need to get some additional user information from our platform when a chat (messaging) is initiated. Is there a client.on('<something>') specifically for when a chat (messaging) has been initiated? If not is there a way I can tell that an active ticket came in through messaging other than calling the tickets API and checking the ticket>via>channel attribute?

    "ticket": {
        "url": "url",
        "id": 12345,
        "external_id": null,
        "via": {
            "channel": "native_messaging",
...
}
thanks

Andrew Wells

0

1

1 comment

image avatar

Tipene Hughes

Zendesk Developer Advocacy

Hey Andrew,

It sounds like the channel object might be what you're looking for. This will allow you to check the channel that the ticket is being created through, then running some logic based on that. Here's a quick example of how that could look:

client.on("app.registered", async function () {
const channel = await client.get("channel.name");
  console.log(channel);

if(channel['channel.name'] === "chat") {
  const requester = await client.get('ticket.requester');
  console.log(requester)
}
});

I hope this helps! Feel free to reach out with any questions.

Tipene

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post