Last active
November 19, 2020 02:48
-
-
Save ambiorixg12/ded1cd90d832b36d654cb3f58d843845 to your computer and use it in GitHub Desktop.
Trigger a Twilio Studio Flow Execution via the REST API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Testa CODE to read webhook values | |
| <?php | |
| header("content-type: text/xml"); | |
| echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; | |
| foreach($_REQUEST as $key=>$value){ | |
| print_r($_REQUEST); | |
| shell_exec("echo $key : $value >> ./twilio.log"); | |
| } | |
| ?> | |
| ///////////////////////////////////////// | |
| /// This code is the one on production to trigger the flow and pass parameters | |
| <?php | |
| $FWID=111111111111; | |
| $AC=222222222222; | |
| $TOKEN | |
| $to=8882311212; | |
| $from=90122111; // twilio number | |
| echo shell_exec("curl -X POST https://studio.twilio.com/v1/Flows/$FWID/Executions \ | |
| --data-urlencode \"To=+$to\" \ | |
| --data-urlencode \"From=+$from\" \ | |
| -u \"$AC:$TOKEN\" "); | |
| ?> | |
| https://support.twilio.com/hc/en-us/articles/360007778153-Trigger-a-Twilio-Studio-Flow-Execution-via-the-REST-API | |
| Parameters={"parameter_name":"value"}. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment