Solved

Differentiating between teams and team inboxes from an Event message?

  • 27 December 2022
  • 1 reply
  • 31 views

Badge +2

How do we tell what are the Teams and Team Inboxes related to an incoming email Event message? Or for a conversation? From the examples, I guess the inboxes part would be it and the is_private boolean would be false for Team Inboxes? 

icon

Best answer by Support Engineering 27 December 2022, 18:34

View original

1 reply

Userlevel 1
Badge +5

If you want to look up the inboxes for a conversation, you can use the list conversation inboxes API endpoint. When receiving payloads for inbound message events, there should be an object listing the inboxes the message was received in. 

 

As for how to determine the owner of the inbox, there are a couple of things you can look at.

 

Let's inspect an example payload;

{
"_results": [
{
"_links": {
"self": "https://cloud-content-consulting.api.frontapp.com/inboxes/inb_42olp",
"related": {
"channels": "https://cloud-content-consulting.api.frontapp.com/inboxes/inb_42olp/channels",
"conversations": "https://cloud-content-consulting.api.frontapp.com/inboxes/inb_42olp/conversations",
"teammates": "https://cloud-content-consulting.api.frontapp.com/inboxes/inb_42olp/teammates",
"owner": "https://cloud-content-consulting.api.frontapp.com/teams/tim_2agp9"
}
},
"id": "inb_42olp",
"name": "Customer Success",
"is_private": false,
"is_public": true,
"address": "a54724cfd3c60cc8",
"send_as": "a54724cfd3c60cc8",
"type": "custom",
"custom_fields": {}
}
],
...
}

 

There are three fields to pay specific attention to;

  • _links.related.owner - this gives us an API URL to fetch the owner. Note that the URL will either contain /teams/:team_id or /teammates/:teammate_id - you can use this to tell if the owner is a team or a teammate.
  • is_private - this will be true when this is an individual inbox (i.e. the owner is a teammate)
  • is_public - this will be true only for team inboxes where the inbox has been set as a public inbox

 

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

 

--Jason

Reply