Get a notification once the agent answers a call.
Hello, I'm building an application on top of the Zendesk talk. I need to get a notification once the agent accepts the call, or when the ticket is created based on the voice channel. Could you please help me with this? I'm using ZAFClient.
-
Thank you Tipene for your response!
Do you know if the JS SDK can receive this event on the client side? -
Hi Boris,
You'd need to have a backend service of some kind to ingest the API call from the webhook. If you want to have it self contained within a ZAF app, here's a basic example that should do what you're looking for:
client.on("app.registered", async () => {
// Get ticket data
const ticketData = await client.get("ticket");
// Save new ticket status boolean and channel value to variables
const ticketStatus = ticketData.ticket.isNew;
const ticketChannel = ticketData.ticket.via.channel;
// Check if ticket is new and if it is via the voice channel
ticketStatus == false && ticketChannel == "voice"
? // Create the notification here
console.log("This is a new ticket based on the voice channel!")
: null;
});
This is just grabbing the ticket details via theclient.get
method then comparing the values and printing to console if it is successful. You can add some code in place of the console.log to create the notification type you need. I'd also suggest adding some error handling to catch any issues.
I hope this helps! Let me know if you have any questions.
Tipene
-
Thank you very much Tipene, it is precisely what I need 😎
댓글을 남기려면 로그인하세요.
4 댓글