Search code examples
imagetwiliotwilio-studio

How to determine if an SMS Message has Images Using Twilio Studio?


How do I check if an SMS message has an image or not? I'm using Twilio Studio.

  • I think I should use the Split Based On Flow Control action...

enter image description here

  • ...to test the trigger.message.Body variable.

enter image description here

  • But what do I enter for the Transitions values?
  • And what should I use for the Contains (or Does not contain) clause?

enter image description here

Is there a way to check for BOTH a .jpg (+ .jpeg) and a .png?


Solution

  • Instead of checking the trigger.message.Body which contains the text of the message, you should check trigger.message.NumMedia which tells you how many images were sent.

    You can then add transitions to test whether NumMedia is "0" or if matches any of "1" through "10".