Solved

How to generate a conversation link from a `/channels/xxx/incoming_messages` response

  • 4 July 2023
  • 4 replies
  • 162 views

Badge

Hi, front team, I’m using `/channels/xxx/incoming_messages` API to create custom message to front.

I got a response like

```

{"conversation_reference":"xxx","message_uid":"xxx","status":"accepted"}

```

how can I generate a link to this conversation, to help to link to the conversation directly from our internal system?

Thanks!

icon

Best answer by jason 5 July 2023, 18:02

View original

4 replies

Badge

alternatively, how can I generate a image url from the attachments object within the message

{ "id": "fil_xxx", "url": "https://xx.api.frontapp.com/download/fil_xx", "filename": "IMG_6111.JPG", "content_type": "image/jpeg", "size": 2482106, "metadata": { "is_inline": false } }

the url in the object need authentication, can I generate a link without authentication?

Userlevel 4
Badge +7

Hi Tom,

Due to the way in which Front processes inbound messages, we create a message with a UID quickly and return that response to you, while we work on creating a new conversation, or threading the new message into an appropriate existing conversation, so the conversation ID does not exist at the time you receive the API response.

You can use resource aliases after receiving the message UID to fetch the message from the API;

GET /messages/alt:uid:<MESSAGE_UID>

This will return the message details, including the conversation ID that has now been assigned. 

 

Regarding attachments, the requests to fetch attachments from Front’s API must be authenticated. If you want to fetch them unauthenticated, you’ll need to configure some kind of proxy service to perform an authenticated fetch (you hit your service unauthenticated, which fetches the attachment from Front with an authenticated request, and returns it)

Badge

@jason thanks for your help, our product released this week.

but a have some minor issues, here is one.

after calling the create message API, we use the returned message_uid to query message_detail, but once a while, the get_detail api will return 404, which means the messages does not exists.

Is the message not stored yet at that moment, if so, do you have any suggestions?

 

Thanks again.

Userlevel 4
Badge +7

Hi @Tom Yuan , Sorry about the long wait here. 

Typically that 404 means Front is still processing the message. We typically recommend having your code wait an few seconds and retry fetching the message. If it’s still not present after a few seconds, it might mean something went wrong during sending. If you have a specific `message_uid` you’d like us to investigate, please feel free to share it directly with our team and we’ll be able to track down exactly what is going on. 

Reply