Multi-channel Campaign

 

**You must complete at least one of the previous single-channel campaign tutorials (SMS, Email, or Voice) before starting this multi-channel tutorial.**

The multi-channel campaign, after retrieving the list of eligible customers, will check which contact method they prefer and trigger the respective subflow.

Once you already have your “Sample CRM” table and a campaign bot set up with the HTTP gateway flow and subflow, you can take the following steps:

Add “PreferredMethod” field to “Sample CRM” table in Files & Data.

Use the dropdown in the upper left to navigate to Files & Data.

Screen Shot 2018-05-07 at 15.27.18

Open up your Sample CRM table and click the “Edit Table” pencil icon at the top.

Screen Shot 2018-05-16 at 16.06.59.png

At the bottom of the Fields section, click “+ Add New Field”.

Screen Shot 2018-05-16 at 16.23.36.png

Click the new field that shows up at the bottom of the list and set Label and Name to “PreferredMethod”.

Screen Shot 2018-05-16 at 16.30.38.png

Scroll to the bottom of the Edit Table window and click Update. Now you should see the PreferredMethod field in your table.

Screen Shot 2018-05-16 at 16.31.51

We will assume three expected values for PreferredMethod, to represent the different channels a customer can choose as their preferred means of contact. These three expected values will be “sms”, “email”, and “voice”. Go ahead and set the value of PreferredMethod for all the customers in your table, making each value is represented at least once.

Screen Shot 2018-05-16 at 16.34.47.png

If most of the records in your table show “contacted”, as they do in the above screenshot, set them all back to “new”.

Create a new bot called “Multi-Channel Campaign”

Back in your Bot Designer homepage, create a new blank bot and give it the name “Multi-Channel Campaign. Save this bot and go back to the homepage.

Duplicate HTTP Gateway Flow

Just like the single-channel campaign bots, this one will need a HTTP Gateway flow. This new version won’t differ too greatly from the previous version(s), so we will duplicate a previous version to save time.

Open up the bot for whichever campaign tutorial you already completed. (The example here will be from the SMS Campaign tutorial bot, called “Mass Texter”.)

Once inside your campaign bot, open up the “HTTP Gateway” flow and get into Edit mode.

Screen Shot 2018-05-16 at 17.06.53.png

In the General tab, open the Advanced dropdown and click “Flow source”.

Screen Shot 2018-05-16 at 17.08.08.png

A window will then open showing the source code for the flow. Select all, then copy.

Screen Shot 2018-05-17 at 13.55.51.png

Hit the Cancel button to close the Flow Source window, then exit back out to your Bot Designer homepage. Open up the Multi-Channel campaign bot again, the click the plus button to add a blank flow.

Screen Shot 2018-05-17 at 16.32.17.png

When the new blank flow comes up, open up the Advanced dropdown and select Flow source again.

In the Flow Source window, select all, then paste. (You need to replace what is already there with what you copied from the other flow.)

Screen Shot 2018-05-17 at 16.34.14.png

Click Save Changes and the canvas will populate with the flow logic. Then click Save Flow to actually create the flow before we start making our changes.

Change Path

First, select the gateway step and change the value of the Path field, so this flow’s trigger will be differentiated from the one you copied. Here I’ve changed the path from “massSms” to “campaign”.

Screen Shot 2018-05-17 at 17.44.51.png

Add PreferredMethod check to HTTP Gateway

We can now go ahead and make changes to support channel preference. We will simply need to add a Check Condition step to determine which subflow to trigger.

On the canvas, select the “trigger sms subflow” step (should be the second step after the loop condition), then click the scissors icon on the left side to split the tree off of the main logic.

Screen Shot 2018-05-17 at 16.38.59

Drag the separated tree off to the side so it is out of the way of the newly empty node.

Screen Shot 2018-05-17 at 16.40.51.png

Add a Check Condition step to that empty node.

Screen Shot 2018-05-17 at 16.41.55

Edit the “next” condition to check if the value of {setRecord.currentRecord.PreferredMethod} is equal to “sms”.

Screen Shot 2018-05-17 at 16.44.17

Create two more conditions that check the value of {setRecord.currentRecord.PreferredMethod}, one for “voice” and one for “email”.

Screen Shot 2018-05-17 at 16.47.03

Trigger subflow based on preferred method

Now select the “trigger sms subflow” step you sliced off earlier and drag it back onto the “sms” node.

Screen Shot 2018-05-17 at 16.49.17

Add another Trigger a Flow and Proceed step under the “voice” branch, followed by a Go to step. We can’t yet configure Trigger a Flow and Proceed, since we don’t have any active subflows in this bot.

Screen Shot 2018-05-17 at 16.51.34.png

Configure the Go to step to point to “increment counter”, so the loop will continue after the Voice subflow is triggered.

Screen Shot 2018-05-17 at 16.53.41.png

Select the Trigger a Flow and Proceed step again, rename it to “trigger voice subflow”, and click the Clone Tree button on the left side.

Screen Shot 2018-05-17 at 16.55.54

Screen Shot 2018-05-17 at 16.56.43

Drag the duplicated step tree snippet onto the “email” node, and change the trigger step title to “trigger email subflow”.

Screen Shot 2018-05-17 at 16.58.00.png

We will ignore the “else” branch for now, as there is no other possible value of PreferredMethod.

Lastly, we need to adjust the messaging for the successful HTTP response. Select the Send Response step underneath the “else” branch of the loop condition, and make the message generic. Here, I have changed the “Triggered SMS flow” portion of the text to “Triggered subflows”.

Screen Shot 2018-05-17 at 17.49.40.png

That’s it for the HTTP Gateway for now, so go ahead and save the flow before exiting back out to your Bot Designer homepage.

Add subflows

Now we need to copy the first subflow into the new bot, so open up your first campaign tutorial bot again. Follow the same steps you took to duplicate the HTTP Gateway flow, this time with the subflow (either SMS subflow, Voice subflow, or Email subflow, depending on which tutorial you completed). (Edit mode > General tab > Advanced > Flow source > select all > copy; then paste into Flow source of new blank flow in target bot.) Here, we’ve duplicated the SMS subflow.

Screen Shot 2018-05-17 at 17.05.22.png

As luck would have it, we don’t need to change anything about this flow! Go ahead and save and activate.

At this point, your “Multi-Channel Campaign” bot should have two flows: “HTTP Gateway”, which is inactive, and “[insert your channel here] Subflow”, which is active.

  • If you completed all three tutorials, go ahead and duplicate the other two channel subflows into Multi-Channel Campaign, then activate them.
  • If you did not complete all three tutorials (SMS, EmailVoice), open up the one(s) you did not complete and follow the subflow creation instructions. Build the new subflows inside your multi-channel bot.

When you’re done, your Multi-Channel Campaign bot should have four flows: HTTP Gateway, SMS Subflow, Email Subflow, and Voice Subflow. The subflows should be active, and the HTTP Gateway should be inactive.

Screen Shot 2018-05-17 at 17.31.22

Now, all we have left to do is configure the Trigger a Flow and Proceed steps in “HTTP Gateway” to point to the appropriate subflows.

Finish HTTP Gateway

Open up the HTTP Gateway flow and get into Edit mode. Click on “trigger sms subflow” under the “sms” branch and select “SMS Subflow” from the dropdown.

Screen Shot 2018-05-17 at 17.33.41

Fill in the “Parameters expected by triggered flow” using merge fields:

  • Phone = {setRecord.currentRecord.MobilePhone}
  • Name = {setRecord.currentRecord.FirstName}
  • Message = {httpRequest.request.body.Message}
  • RecordId = {setRecord.currentRecord._MetaData.Id}

Screen Shot 2018-05-17 at 17.36.04

Configure the “trigger voice subflow” and “trigger email subflow” steps in this same fashion:

Screen Shot 2018-05-17 at 17.40.12.png

Screen Shot 2018-05-17 at 17.41.58.png

Once you finish configuring the trigger steps, you can save and activate this flow! Now follow the same steps as in the previous tutorials to trigger your HTTP flow via API and see what happens. Try changing the value of PreferredMethod in the customer record that contains your contact info to try out the different channels.

 

Great job!

You’ve created a multi-channel campaign! As you can see from this process, it’s a good idea to think about reusability of components as you build a solution. You can also see how simple it would be to add another possible contact method to the solution, or even add additional checks to further specify the bot’s behavior. Feel free to play with this solution and expand upon it!

Advertisements