SOLVED

Format Date MM/DD/YYYY for use in a webhook

Go to solution
Adam_Blinzler2
Level 2

Format Date MM/DD/YYYY for use in a webhook

I am looking for a way to change the date format from YYYY/MM/DD to MM/DD/YYYY when sending a Twillio sms message using webhooks. My understanding is that you cannot use Email Scripting Tokens in a webhook only basic text tokens and lead tokens.

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Grégoire_Miche2
Level 10

Re: Format Date MM/DD/YYYY for use in a webhook

On top of Sandford’s point, we usually prefer text tokens to date tokens when using dates that should be displayed or used in webhooks, precisely for this reason.

Greg

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Format Date MM/DD/YYYY for use in a webhook

I am looking for a way to change the date format from YYYY/MM/DD

For Marketo Date/DateTime fields, the date format is yyyy-MM-dd (hyphens, not slashes). That's standard ISO 8601 date format.

The only way to change that output format is to pass the field through another webhook (before sending to Twilio) that copies the Date, in a different format, to a new String field created for that purpose.  Then pass that String field to Twilio.

Grégoire_Miche2
Level 10

Re: Format Date MM/DD/YYYY for use in a webhook

On top of Sandford’s point, we usually prefer text tokens to date tokens when using dates that should be displayed or used in webhooks, precisely for this reason.

Greg

Adam_Blinzler2
Level 2

Re: Format Date MM/DD/YYYY for use in a webhook

Thank you guys. I was hoping they would be a different workaround but it looks like we will create duplicate fields one as a text field for display and one as a date field for the program. I am not sure if it has been asked before, but I did create an idea of being able to use Email script tokens in webhooks. Thank you again for your quick replies.

Jay_Jiang
Level 10

Re: Format Date MM/DD/YYYY for use in a webhook

We use a php endpoint to receive the webhook data from Marketo and transform the data before forwarding the data to Twilio. For us it was much easier to write logic to standardise phone numbers before sending to Twilio than to update the whole database. Transforming the formatting of dates would be very straightforward.

In essence you're using up some of your webserver resources to free up some of Marketo's