Retrieve the ticket id from a specific ticket

The problem is when I click on a specific ticket that clicked ticket’s id is not retrieved. However, when I click on any ticket, the ID of the first ticket from the list is retrieved. like i want that id that displayed in the window.

I have attached screenshots to provide more context and to help you understand the issue better.

Hi Saraswati,

Welcome to this forum!

Sorry, but the problem isn’t very clear to me. Do you need to retrieve the ticket id you are viewing on your app?

Have you tried using this method:

 async function getTicketDetails() {
  try {
    const data = await"ticket");
    // success output
    // data is {ticket: {"subject": "support needed for..",..}}
  } catch (error) {
    // failure operation


This app-sdk method allows you to retrieve ticket data from a ticket detail page on a frontend-app

Hope this helps!

You need to get it via this app.initialized event.
App initialization occurs when the page that contains your app is loaded for the first time

let client;
async function init() {
  client = await app.initialized();"app.activated", onAppActiveHandler);"app.deactivated", onAppDeactiveHandler);

I replied to you in the chat but also posting the issue with the code you wrote:

Based on the code screenshot, you are getting 1507 because that’s the recent ticket from your fetchAllTickets function’s response that is on top.

You cannot fetch the open ticket using the code you shared. What you’re doing in your code screenshot is getting all tickets and printing the first ticket from there which is not related to your requirement of getting current open ticket. You have to start with creating an app using fdk and then use the code suggested to get the current open ticket.

To get the open ticket, I would recommend using the following snippet like how @Mattia_Piparo pointed out in their response:"ticket").then(function(data) {
var ticketId =;
var ticketTitle = data.ticket.subject;

console.log("Ticket ID:", ticketId);
console.log("Ticket Title:", ticketTitle);
}).catch(function(error) {
console.error("Error fetching ticket data:", error);

Also, please delete your code screenshot or blur the Auth Token :pray:

1 Like