Solved

Analytics report metrics

  • 3 January 2023
  • 3 replies
  • 76 views

Badge +2

I’m trying to extract CSAT information on a daily basis but it seems I’m being forced to hit the API many times to get this information.
 

First of all, I'm trying this endpoint: https://api2.frontapp.com/conversations/search/commenter%3Atea_12345%20after%3AstartDate%20before%3AendDate where startDate and endDate are variables to iterate through days. Then, for each conversation, I request the comments endpoint and filter the one that is emitted by the user front_csat.

 

I understand that are a lot of requests at the same time, but it was the only way we found to have a dataset with this data:
 

  • Conversation ID
  • CSAT
  • Followers
  • Conversation Date

Maybe you know another way, or you can give me an advice.

icon

Best answer by Support Engineering 3 January 2023, 17:56

View original

3 replies

Userlevel 1
Badge +5

Thanks for providing the context. So I understand you're trying to extract CSAT responses. I think there is a more effective way to achieve this. The method you're using returns all Conversations which contain a comment matching your search, so then for each Conversation you need to perform queries to fetch Comments.

 

I think the better option is to run Analytics Exports

You can run analytics exports via the API (see API docs). You'll need to run the "events" type of export to fetch all events which could match. 

In the CSV export that you download from this, there will be columns which contain the CSAT survey message, rating, and teammate who received the rating. 

This screenshot shows a little snippet of some of the data that can be extracted in this way:
 

 

The analytics export can be specified to run on specific inboxes if necessary, and over any period of time (though running them for longer than 6-12 months often takes a very long time)

 

I hope this is helpful - Please let me know if you have any further questions

 

--Jason

Badge +2

Hi Jason! Thanks, I'm considering downloading as a csv that way, but it's a really heavy file and it's difficult to update.

 

Else, I filtered by events but the csv has messages as well, so it had nearly 2 million rows. Is there a way to filter just by comments?

 

In Events I found this: https://dev.frontapp.com/reference/get_events

 

I tried to request this endpoint: https://api2.frontapp.com/events?q=types%3Acomment%20after%3A1651363200.0%20before%3A1653955200.0

 

But the query didn't filtered by comments, now I have every event in that timelapse. Am I doing something wrong?

 

Thanks

Userlevel 1
Badge +5

The /events endpoint should be used as follows:

https://api2.frontapp.com/events?q[types]=comment&q[before]=1649574000&q[after]=1649487600&limit=200


As a curl request:

curl 'https://front.api.frontapp.com/events?q\[types\]=comment&q\[before\]=1649574000&q\[after\]=1649487600&limit=200'


Regarding the analytics export, if you want to do one large backfill export, you can do it via the UI, and specify only "comment" type events are exported, and even limit the columns returned.
When running them via the API you don't have as much flexibility, but the files should not be as heavy if you're running this as a regularly scheduled job (daily, for example)

Thanks

Reply