SDK catching phone number when click to contact phone in ticket in freskdesk

Dear Support Team,

I have custom app in freshdesk. I need to catch the phone number when click on contact phone in ticket. I attach image below.

Looking forward to your reply.

Thanks & Regards.

Hi @Quang_Son,

Welcome to Freshworks Developer Community :tada:

Have you tried this?

Make a GET request to /api/v2/tickets/[id]?include=requester ? As per docs, it will return the response with requester’s email, id, mobile, name, and phone.

Hi @Saif

I need to catch click event API on the contact phone, example: client.events.on(“ticket.replyClick”, eventCallback). Then in the function eventCallback, I will use GET request to /api/v2/tickets/[id]?include=requester to get phone number

Looking forward to your reply.

Thanks & Regards.

You can can make a request under eventCallback

function eventCallback(){
 // Request to the above end point.

// Parse the response JSON and capture the phone number.

// Do the business logic that'd be needed.
}

client.events.on("ticket.replyClick",eventCallback);

Hi @Saif,

But I need to trigger click contact phone not trigger replyClick. How can do that :frowning:

Thanks & Regards.

Oh. Let me try to understand your question more clearly.

When ever user clicks on the phone number that is on the right handside inside the Freshdesk product, you want to make a phone call?

Please correct me if I am wrong.

Hi @Saif

Yes, I need to listen event when user clicks on the phone .

HI @Quang_Son,

You can access the phone number in side the product using

client.events.on("cti.triggerDialer", callback);

function callback(event){
 let data = event.helper.getData();
data.number; // will have number User has clicked on the page
}

We also have a sample app for you refer to. It demonstrates it via CTI app.

Let me know if that helps.

Hi @Saif,

Thanks for your snippets code. I have solved that issue.

Regards.

Hi @Saif,

After use triggerDialer, I get a phone number. But I don’t know where is the page I received the phone number? Contact detail or ticket detail? And if in ticket detail, could you give me the id of ticket?

Thanks & Regards.

There are couple of Data methods that you can use to get ticket details if you are Ticket Details page.

For example,

client.data.get("ticket", function ticketinfo(payload){
payload; // payload will have property name of "id"
})

Hi @Saif,

I doing like your snippet code but the response return error.
I attach image below:


Looking forward to your response.

Thanks & Regards.

I attach more image. Here my snippet code.

@Quang_Son,

  1. The see that your app is running on Global Side Bar which is the place where “left_nav_cti” placeholder works.
  2. Apps running in these locations only have access to Global Data APIs. My suggestion earlier didn’t work because Ticket Details APIs are accessible for the apps running in Ticket Details page only.

Please allow me some time to find the alternative way to capture Ticket ID.

Hi @Saif,

Looking forward to your alternative way to get ticket id.

Thanks & Regards.

Hi @Quang_Son,

I found out that Freshdesk doesn’t provide the Ticket Details context to CTI app currently. I will consider this as a feature request and pass it on to Freshdesk team. Unfortunately, there are no workarounds for this as well.

This topic was automatically closed after 5 days. New replies are no longer allowed.