Returning a response flag to the Parent bot

We will return a Good or Bad flag to the Parent bot based on the output we get back from Twilio. Follow these steps to do so:

  1. First, let's read the Connection property from the output dictionary variable. This contains the Twilio REST response. We will use the String Assign action to assign the value of $output{Connection}$ to a new String variable called OutputResponse:

  1. Now, we'll use an If condition to check this OutputResponse and set the return flag for the Parent bot. We will check $OutputResponse$ for the target value of keep-alive. Within the If condition, since the response is good, we'll use String Assign to assign a value of Good to the Response output variable, as shown in the following screenshot:

  1. If the response isn't good, then we'll need to send a bad response within the If Else action. Let's add another String Assign so that we can assign a value of Bad to the Response output variable, as shown in the following screenshot:

  1. Finally, we'll also return a bad response if there are any errors. So, within the Error handler we added earlier, let's add another String Assign and assign a value of Bad to the Response output variable, as shown in the following screenshot:

Now that we have finished configuring the Child bot, let's unit test it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.153.167