Solved

% of Messages with SLA Breaches

  • 15 November 2023
  • 5 replies
  • 138 views

Badge +1

Is there any possibility to fetch the messages (not conversation) which has respond time more than 48 hours (example). The purpose of this to fetch the messages respond which has breached pre-defined SLAs (which in our case is 48 hours).

 

So, what I am thinking is to fetch number of messages sent in a specific time period and then fetch the messages with respond time more than 48 hours.

 

The below code (API Endpoint) can be used to fetch number of messages sent:
 

import requests

url = "https://api2.frontapp.com/analytics/reports"

payload = { "metrics": ["num_messages_sent"] }

headers = {

    "accept": "application/json",

    "content-type": "application/json",

    "authorization": "Bearer <Token>"

}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

 

But how can I fetch messages with respond time more than 48 hours ?

If there is better approach to perform same task, feel free to mention ?

 

icon

Best answer by justin 15 November 2023, 20:13

View original

5 replies

Userlevel 3
Badge +7

Hi, 

Justin here with the support engineering team 👋

By creating an analytics export and providing “messages” as the “type” value, you will receive a link to fetch the report

In the report payload, you will see a URL for a CSV. This will provide all messages within the timeframe set for the analytics report, plus any applicable filters. These message rows will contain a response time value that should help you determine if the message is greater than 48 hours. 

From there you can implement the logic needed on your end to count these messages and determine the metric. 

Badge +1

Hi Justin,

 

Thanks, it’s really a great solution.

 

Just to go further for automation of whole process. In this solution, I can get CSV file containing all the information. Once I get the CSV file, then the manual work need to be done which will involve opening the CSV file, implementing the filter for response time more than 48 hours, and then fetch the value. Well is there a way to automate the process via Front APIs or something else ?

Userlevel 3
Badge +7

Since response time is found in analytics, this would still be my best recommendation on how to obtain this custom metric with the current API endpoints. It is the most direct approach at the message level that will allow you to add in additional filters for the report such as timeframe, tags, inboxes, etc. 

If the concern is around automation, there are methods in which you can write scripts to read and extract values from a csv file. While we do not have the resources to provide here, however, there are several resources online that pertain to the topic that may help you in automating this further. 

Hopefully this helps provide further clarity and gets you moving in the right direction!

Badge +1

Thanks Justin, one last thing. I fetched the report. After seeing the reports I have few questions which are below:

  • Is the Response time in seconds ?
  • There are many sent messages which does not have any “Response Time”. Just for clarification, are these messages which initiated the conversion instead of response to current mail ?

 

 

Userlevel 3
Badge +7

Hi, 

Yes, Response Time is in seconds. As far as seeing no response time for messages, this could be for a few reasons. I’ll list the most common below: 
 

  • In cases with multiple outbound replies sent to the same inbound, only the first reply is taken into account when calculating reply time.

  • Auto-replies are not considered replies in Front and do not count towards reply times

  • Inbound messages without outbound replies do not count towards reply times.


Hopefully this helps clarify the metric! 
 

Reply