Skip to main content

Hello, 

I am assessing whether Front will work for my business use case. I need to use a number of Twilio WhatsApp channels for my clients all of which are Business accounts. Business accounts have some limitations around messaging and messaging windows and as a result need to use pre-cleared message templates when sending messages to users outside of a conversation window. Does Front support sending Twilio message templates via the Front API?

Additionally does Front support web hooks for listening to messages (both inbound and outbound messages to the channels?

Thanks!

Hi,

Yes - you can send templated messages using the API; the text of the sent message simply needs to (exactly) match the structure of your approved template. 

Yes - Front will subscribe to inbound messages received in Twilio and import them into Front immediately. 

For outbound messages sent outside of Front, Front will receive them eventually - check out this How to set up a Twilio WhatsApp inbox in Front guide for details. 


Does Front support sending WhatsApp templates from Front for a Twilio WhatsApp channel?


We don’t support an integration with the templates, but again - just send the matching content and they’ll go through - see this article for details


Got it, will Front return an error status to the create message API call if the WhatsApp template isn’t valid / a different error code if the template fails to send versus if the messages fails to send?

Additionally is there documentation surrounding retry policies / if there is any / the error codes for the create message?


It will, yes - you’ll see a Twilio error code printed in the Front conversation timeline (usually the 63016 error).

Note: if you’re sending conversations via API, Front will always return a 202 Accepted header, then attempt to send the message via Twilio. You’ll be able to use the returned message UID from the Accepted response to fetch the message and check if it sent. You can also subscribe to sending errors via webhook to receive notifications in your app if any outbound messages fail.


Got it, I am mostly interested in the API here but appreciate the clarity on both fronts. 

So I send a message get the UID, then get the message and I would evaluate the error_type attribute I assume? And how would I check for a successful template send via Twilio since I assume error_type stays as null unless an error occurs.


@jason bumping this, would like to get confirmation on handling failed template sends through Front


That’s correct - if you fetch the message by UID after attempting to send, and there was a sending error, the “error_type” field in the response would be not-null (specifically if you get the 63016 error, it should read “twilio_sent_freeform_message_failed”), and the message will be in a draft state with the author. 


Yeah got it, but time wise is there any latency consideration where I poll the API and the message has not yet been sent to Twilio / is in a retry state to Twilio and so the error type is still null / I need to check after some time lag?


Additionally, is there a way to discern via listening to Front webhooks whether a message was sent via Front or the Front API?


We generally recommend listening for sending errors through webhook subscriptions in order to minimize the time between the error occurring and an API integration becoming aware of the error.  Polling won’t be able to account for the variance error timing, so we can’t advise on an effective polling period.  Webhooks will almost always be faster, and reduce your overall request quota consumption.

Front doesn’t explicitly differentiate between messages sent from app versus the API, but you can check the `author` property.  If you send from the API with no author, this field should be empty on message events.


@evano I am not seeing an author field in the payloads I am getting? I am specifically talking about monitoring web hooks and being able to determine from the message created webhook whether a message was created with the API or from Front

Front event payload: "authorization=FrontAuthorization(id='cmp_5t6zf') type='outbound_sent' payload=FrontPayload(conversation=FrontConversation(id='cnv_1d7ssuaj', subject='', status='assigned'), source=FrontSource(data==FrontInbox(id='', name='', type=None, address=None, send_as=None, is_private=False, is_public=False, custom_fields={}), FrontInbox(id='inb_eoriz', name='Test', type='twilio_whatsapp', address='+', send_as='+', is_private=False, is_public=False, custom_fields={})]), target=FrontTarget(data=FrontMessage(id='msg_2is7ak0r', type='whatsapp', is_inbound=False, created_at=1727476343.584, blurb='xxx', body='xxx’, text='xxx', recipients=tFrontRecipient(name=None, handle='+', role='from'), FrontRecipient(name=None, handle='+', role='to')], attachments=t])))


The only thing I can spot is subject having “re: “ vs being blank when sent via the API but that doesn’t seem robust?


Hi there!

That payload doesn’t have an author field as the message was sent through the API.  Please send a message from inside Front to see a webhook payload with an author object attached.


Reply