How to create draft reply with FrontApp API

  • 18 April 2023
  • 8 replies

Badge +2

We used the “Create Draft Reply”

In the API, it requires a channel_id which is only optional when we simply reply the conversation


Where should I get the channel_id? I want to make sure the channel_id is the same as the inbound message that I creating draft for. I looked through both the conversation and message entity, there is no channel_id.


Best answer by jason 19 April 2023, 00:38

View original

8 replies

Userlevel 3
Badge +6

Hi Rob,

The channel a message was received on is typically not returned via the API for a few reasons, so you do need to make a more active selection here. 
What’s likely the easiest method is to assess the recipients on the previous message, figure out which are channels, then use resource aliases to set the channel ID. 

Badge +2

Thank you. It looks that the alias uses the following format: alt:ALIAS_NAME:ALIAS_VALUE. 

I assume that ALIAS_VALUE is the handle of recipient. What is the ALIAS_NAME? I see the message has type like “sms” or “email” or “intercom”, etc. Is it the ALIAS_NAME for channel?

Userlevel 3
Badge +6

So for a Channel, the alias is `alt:address:CHANNEL_ADDRESS` - this might be `` or `alt:address:+14155550000`.


When looking up Contact records, you search by their contact handle (phone number, email, Intercom handle, etc) and could send `alt:phone:+1415555...` or `` or alt:custom:78723487234...` (“Custom” being a catch-all for handles that are not an email or phone type.


Badge +2

Thank you. A follow up question, 

I am following to create draft. But the API keeps returning 404 on{conversation_id}/drafts 

Is there anything I am missing?

Badge +2

I tried multiple possible ways to use alias as the channel ID, no success so far. Do you have a sample code on how to create a draft to reply the last message of a conversation? That will avoid going back and forth on this matter. 

Badge +2

This is the params that I sent to the{conversation_id}/drafts 

sending reply draft msg with params = '{subject=SMS thread with +1123456789, to=[+1123456789], author_id=tea_xxxxfm, body=I'm sorry, but it seems like we're still stuck in a loop here. Is there anything specific you need help with?, channel_id=alt:address:+1123456789}'

But I keep getting the following error:

{"_error":{"status":404,"title":"Not found","message":"Resource not found."}}


Can you shred some light on this?

Badge +2

I found the solution, the channel ID needs to be the “to” recipient. 

But there is another issue, when craft is sent, it triggers message creation event of which the last message is still the last inbound message rather than the created draft message. But it is not blocking issue for us, we will figure out something.

Thank you.

Userlevel 3
Badge +6

Hi Rob,

I spotted the error in our logs. It looks like you were sending the request with the number in the channel_id being the number of the recipient (the external number) rather than the channel in Front. You were getting a 404 not found because Front was trying to look up a channel with that address, which did not exist. 

Regarding your last question, it would be helpful to see a clear example of this in action - if you’d like to share the payload you received with Front Support Engineers at, we’d be happy to take a closer look