Get a notification once the agent answers a call. | Community
Skip to main content

Get a notification once the agent answers a call.

  • August 24, 2023
  • 4 replies
  • 0 views

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.

4 replies

Tipene
  • August 25, 2023
Hey Boris,
 
It sounds like this might be a good use case for triggers and webhooks. You can use the trigger to listen for new tickets via the voice channel, then notify a webhook which you can use to make a call to an external API.
 
Let me know if this works!

  • Author
  • August 28, 2023

Thank you Tipene for your response!

Do you know if the JS SDK can receive this event on the client side?

Tipene
  • August 31, 2023
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 the client.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

  • Author
  • September 1, 2023

Thank you very much Tipene, it is precisely what I need 😎