Looping through the employee list and sending text messages 

In this section, we will read each of the Excel rows and invoke the Child bot so that we can send messages to employees on the list:

  1. Let's add another Step action so that we can logically separate out this block. Add a Step Action and name it Loop through Employee List and send Text Messages.
  1. Within this Step, add a Loop Action. We will iterate for each row in the worksheet and assign the current value to a new Record variable, which we will call CurrentRow, as shown in the following screenshot:

  1. Now, we can get the employee name and number from this record variable. As you may recall, Employee Name was in the first column and Employee Number was in the second column. Let's assign them to two new variables:
    • Use String: Assign to assign $CurrentRow[0]$ (the first column) to a new String variable called ReceiverName
    • Also, add another String: Assign to assign the next column, $CurrentRow[1]$, to another new String variable called ReceiverPhoneNumber, as shown in the following screenshot:

  1. We'll add a message that we need to send. You can send any message you like; for example, we added Due to Virus outbreak, please work from home. Thanks, HR. Then we'll assign this to a new variable called MessageContent.
  2. Let's also assign the URI that we need to invoke the Twilio REST API. It is of the following format: https://api.twilio.com/2010-04-01/Accounts/<Your Twilio Account SID>/Messages.json. Note that you need to add your Twilio account SID to the URI, as shown in the following screenshot:

The current edition of A2019 does not allow us to invoke credential attributes in normal variables. Therefore, we have to hardcode the Twilio SID in the URI.
  1. Finally, let's add a Dictionary variable so that we can capture the output we will get when we invoke the Child bot. Call it TaskOutputDictionary. Set it to Use as output, as shown in the following screenshot:

  1. Now, we have populated all the necessary variables so that we can invoke the Child bot. Let's add the Task Bot Run Action. Browse to the Child bot we created for this project and select it as the Task Bot to run. Map each of the Input values from the Child bot to the respective variables we created previously, as shown in the following screenshot:

Scroll down and check Upon error, continue with next repeat. Also, Assign the output to variable, that is, TaskOutputDictionary, we created previously (not shown).

Now that we have invoked the Child bot with the required parameters, let's check the response. 

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

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