Save first word in SMS message using Twilio Studio

Viewed 23

I'm working with Twilio Studio trying to get the first word from an SMS text message. The issue is that sometimes the word has a : or ; appended.

Example: TEST: This is a test

I need the TEST alone, without the :.

I tried the truncatewords filter, but TEST: was still returned.

{{trigger.message.Body | split: " " | first | truncatewords: 1 | downcase}}

How is this done?

1 Answers

Looks like I'd just perform another split like:

{{trigger.message.Body | split: " " | first | split: ":" | first | downcase}}

Related