Recent searches


No recent searches

Click to call feature for CTI app



Posted Jan 28, 2022

Hello, I'm trying to implement the click-to-call with my CTI apps which use ZAF. The idea is making any phone number that appears in the Support Page be able to click and pass that value to my CTI app.

As far as I understand, Zendesk doesn't allow that, and there's a workaround:
If an agent visits any User page or Ticket page, all phone numbers on that page will be fetched and displayed in the CTI widget and the agent can click on them to make a call.

My question is, what is the api/ technique to catch the event when agents change/visit any page in Support, and how to fetch all the phone numbers in that page.

Many thanks.


0

4

4 comments

image avatar

Sebastiaan (Sparkly ⭐)

Community Moderator

Hello Thang,

It depends where you expect those phone numbers to appear, but you could add the ticket_sidebar and user_sidebar locations to your app. You don't add any UI there, you hide the app, but you do perform some logic.

Every time the agent opens a ticket or user, a new instance of your app will be created at that location and the app.registered event will trigger. From there you can retrieve the phone number, from the ticket perspective it's client.get('ticket.requester') and from the user perspective it's client.get('user'). That will return the user and it's identities, in the identities you can look for the phone number(s).

Then you take that phone number and pass it to your top_bar location (or where your CTI integration is located). There's a sample here, where a sidebar gets control over the top_bar. Then you can trigger an action in the top_bar and send over the data (the phone number(s)).

0


Hi Sebastiaan (Sparkly ⭐)

Thank you for your detailed answer, I just had a lunar new year break and can only comeback with this by today.
 
I have followed your guide, however there're few things which don't work as I expected:

1. The app.register doesn't hit when I open any ticket. It only hits when I click the reload button in the image below. 

client.on('app.registered', function (data) {

});


2. I tried to hide the ticket_bar app but it still take space as above.
3. I expected to get all phone numbers of a requester but the response is only the first direct line number, my request is:

let settings = {
url: '/api/v2/users/' + id + '.json',
type:'GET',
dataType: 'json',
};

client.request(settings).then();

 

0


image avatar

Sebastiaan (Sparkly ⭐)

Community Moderator

The app.register doesn't hit when I open any ticket. It only hits when I click the reload button in the image below. 

It's a bit tricky; app.registered fires every time a new instance of your app is created (and the framework has been fully loaded). Every time you open a ticket that will be the case. But when you navigate back and forth between already open ticket tabs, then the event won't fire. If you want to catch that event, you can listen to "app.activated".

If it only fires once after reloading the app, then it might not run from the right location? (Maybe just the top_bar or background, but not the ticket_sidebar?)

I tried to hide the ticket_bar app but it still take space as above.

You have to wait for the app.registered event (in the ticket_sidebar location), before you hide the app. Otherwise it might be unreliable. Could that be the case here?

I expected to get all phone numbers of a requester but the response is only the first direct line number, my request is:

You don't have to use the REST API, you can use the Apps Framework API with client.get('ticket.requester').

Or if you want to use the REST API, change your settings variable to:

let settings = {
url: '/api/v2/users/' + id + '.json?include=identities',
type:'GET',
dataType: 'json',
};

0


Thank you Sebastiaan (Sparkly ⭐) for your detail answer.

It's all working well now

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post