Answered

How to fetch conversation statistics?

  • 9 April 2021
  • 8 replies
  • 105 views

I'm making an API call to list conversations using the example on the right here: https://developers.intercom.com/intercom-api-reference/reference#list-conversations/p>

 

But unlike the example response, the response I am getting doesn't contain statistics for the conversation. Am I doing something wrong?

 

Note that I already removed the '\' from the beginning of the example request which I think is there by mistake? The request runs correcltly, it's just missing parts of the conversation model.

 

Thanks!

icon

Best answer by Roy 9 April 2021, 11:46

View original

8 replies

Userlevel 1
Badge

Hello @user1047​ 👋,

 

I just now test this request and get following response:

 

 "statistics": {

      "type": "conversation_statistics",

      "time_to_assignment": 2,

      "time_to_admin_reply": 461137,

      "time_to_first_close": 2414380,

      "time_to_last_close": 2414380,

      "median_time_to_reply": 461137,

      "first_contact_reply_at": 1615376805,

      "first_assignment_at": 1615376807,

      "first_admin_reply_at": 1615837942,

      "first_close_at": 1617791185,

      "last_assignment_at": 1615837854,

      "last_assignment_admin_reply_at": 1615837942,

      "last_contact_reply_at": 1615376805,

      "last_admin_reply_at": 1617720238,

      "last_close_at": 1617791185,

      "last_closed_by_id": 3998818,

      "count_reopens": 0,

      "count_assignments": 10,

      "count_conversation_parts": 22

    },

 

Can you share response and postman configuration? I will try to help.

Hi Roy - what response did you test?

 

The request I am making looks like this:

 

curl "https://api.intercom.io/conversations?order=descamp;sort=updated_at" \

-H 'Authorization:Bearer <MY ACCESS TOKEN>' \

-H 'Accept:application/json'

 

The response I get is 4 pages of type.conversation but which only includes the main fields shown in the example response and the fields with arrays like (teammates, statistics, contacts, etc.) are missing.

 

This is all I get per conversation:

 

{"type":"conversation.list","pages":{"type":"pages","next":"https://api.intercom.io/conversations?order=descamp;sort=updated_at&per_page=20&page=2","page":1,"per_page":20,"total_pages":4},"conversations":[{"type":"conversation","id":"2074400000037","created_at":1617888935,"updated_at":1617889528,"waiting_since":64731793515,"snoozed_until":null,"open":true,"state":"open","read":false,"assignee":{"type":"admin","id":"167378"},"conversation_message":{"type":"conversation_message","id":"805998609","subject":"","body":"<p>hi, i don't see how to compare two metrics together</p>","author":{"type":"user","id":"606f06909e9354d684ffbc01"},"attachments":[],"url":"REDACTED"},"customers":[{"type":"user","id":"606f06909e9354d684ffbc01"}],"user":{"type":"user","id":"606f06909e9354d684ffbc01"},"first_action_at":1617888935,"last_action_at":1617889528,"sent_at":1617888935}

Userlevel 1
Badge

@user1047​ , Can you create a new conversation (User initiated), than close it and try to run this request again.

Just done, I get the same response. This is the newest part of it (for the user initiated convo I just created):

 

{"type":"conversation.list","pages":{"type":"pages","next":"https://api.intercom.io/conversations?order=descamp;sort=updated_at&per_page=20&page=2","page":1,"per_page":20,"total_pages":4},"conversations":[{"type":"conversation","id":"2074400000040","created_at":1617960369,"updated_at":1617960369,"waiting_since":1617960369,"snoozed_until":null,"open":true,"state":"open","read":true,"assignee":{"type":"nobody_admin","id":null},"conversation_message":{"type":"conversation_message","id":"806850352","subject":"","body":"<p>please help</p>","author":{"type":"user","id":"60701da07edc5e0e4c6ec7a9"},"attachments":[],"url":"REDACTED"},"customers":[{"type":"user","id":"60701da07edc5e0e4c6ec7a9"}],"user":{"type":"user","id":"60701da07edc5e0e4c6ec7a9"},"first_action_at":1617960369,"last_action_at":1617960369,"sent_at":1617960369}

Userlevel 1
Badge

@user1047​ , Please, can you check if your API Version is 2.3?

 

To check this follow:

1) Go to https://developers.intercom.com/

2) Your apps

3) Select app from the list

4) Api Version:

App 

Ahh good catch! That's it!!

 

Thank you so much for your speedy responses today!

Userlevel 1
Badge

@user1047​ , Anytime, Always happy to help.

 

Have a great Weekend 🦄

Reply