How to fetch latest 10 conversations in a ticket

Hi Team,

Is there any possible way to fetch latest 10 conversation of a ticket?

Thanks,
Tejasri

1 Like

Hi,

Can anyone help me on this as this high priority

Thanks,
Tejasri

Hi @Tejasri_Kalluri,

We have API’s in freshdesk to fetch the latest 10 conversations using the endpoint
/api/v2/tickets/[id]?include=conversations

In case you need to fetch all the conversations in a ticket. Check the following end point.
/api/v2/tickets/[id]/conversations

Hope it helps

3 Likes

Hi @sarfaraz_Mohammed,

/api/v2/tickets/[id]?include=conversations

i have used this, here it is returning from starting(first conversation of the ticket to 10th conversation) not returning latest 10 conversations and in document clearly mentioned that “will return up to ten conversations sorted by “created_at” in ascending order.” but i need in descending order this there any possible way

/api/v2/tickets/[id]/conversations

this returning all conversations upto 30

actually my requirement is suppose having 45 conversations in a ticket, there need to fetch latest 10 conversations of that ticket, without pagination can you help in this

Warm Regards,
Tejasri.

1 Like

Hi @Tejasri_Kalluri

Unfortunately i din’t find API to get the latest 10 conversation without pagination.
What are you trying to achieve using the conversation details? (eg : display conversation details, email address etc)

Thanks,
Sarfaraz

2 Likes

Hi @sarfaraz_Mohammed,

when i create a child ticket need to fetch latest 10 conversationss from parent and post in the child ticket. But iterating all conversations some times leads to API rate limits and timeout issues as it is SMI. So to resolve this I need the latest 10 convs. If there are any filters also it may be helpful like sort_by etc.

Thanks,
Tejasri

Hi @Tejasri_Kalluri,

I couldn’t find the right API or the right filter on any API. Let me check with Freshdesk product team if there’s any other way or workaround for this.

Otherwise I will take it up a feedback to pass it to the product team.

1 Like

Hi @Raviraj,

ok sure, Thank you and let me know if you find any way for this

Thanks,
Tejasri

Hi @Tejasri_Kalluri

Just a quick thought will it be possible that you can fetch all the ticket conversation details before making SMI call and send the conversation payload as an argument in SMI call.

1 Like

@Tejasri_Kalluri This is currently not possible with Freshdesk API.

I will take it up as a feedback to pass it to the Freshdesk product team.

Please consider if @sarfaraz_Mohammed’s suggestion would work as a workaround. But, I suspect this would cause Request API rate-limit breach.

3 Likes

Use this to fetch all the tickets in descending order

async getAllConversations() {
    let loop = true;
    let page = 1;
    let result: any;
    let conversations: any[] = [];

    while (loop) {
      result = await this.getConversationsPage(page);
      conversations = conversations.concat(result);
      page ++;
      if (result.length != 30) {
        loop = false;
      }
    }
    conversations = conversations.filter(c => !c.private);
    conversations.sort((a, b) => (new Date(a.updated_at) > new Date(b.updated_at)) ? -1 : 1);
    return conversations;
  }

  getConversationsPage(page: number) {
    return this._freshdeskService.getTicketConversations(this.ticketId, page).toPromise();
  }
3 Likes

Hi Riviraj,

Was there a solution for this?

I tried the list all conversations option and hit the API rate limit issue.

I have checked with the product team. No updates on this yet, Rob.

1 Like

OK. Thanks for asking Riviraj

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.