Brand new to Twilio.
I've implemented the Build Voice Mail with SMS and Email Notifications Using Twilio Studio, Functions, and SendGrid tutorial. This tutorial relies on an Environment Variable named TO_EMAIL_ADDRESS
to hold a static email address that is used in the sgMail.send(msg)
command. I'd like to be able to variably set the value of TO_EMAIL_ADDRESS
based on digits collected by a Gather Input On Call
Widget.
I'm currently using the output of "user pressed keys" as two Variables. For one of them, I'm running a basic If/Else to convert the Digit to a String. This string is used in a Say\Play
Widget in the next step.
{%- if flow.variables.department_id == '1' -%}
Dept1
{%- elsif flow.variables.department_id == '2' -%}
Dept2
{%- elsif flow.variables.department_id == '3' -%}
Dept3
{%- endif -%}
I'd like to set the desired email address in the same manner.
That If/Else could just as easily end up as If department_id == 1 then 'dept1@domain.com'...
Do I need to use that Environment Variable in this case? Could I just compute the correct email address in Studio and pass that as part of the Event when calling the Function?
The tutorial is great, and fit the use case. I feel like I'm missing some foundational knowledge though.
Thanks in Advance!