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.
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?
So for a Channel, the alias is `alt:address:CHANNEL_ADDRESS` - this might be `alt:address:support@example.com` 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 `altcustomer@example.com` or alt:custom:78723487234...` (“Custom” being a catch-all for handles that are not an email or phone type.
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.
This is the params that I sent to the https://api2.frontapp.com/conversations/{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?
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.
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 api@frontapp.com, we’d be happy to take a closer look