Step 3: AI Action

We are going to add the AI action that will read the incoming message and then predict if it's about one of the e-commerce intents.

Add API Key/Secret as Flow Configurations

Before we add the AI action, we will need to add a DG API Key and a DG API Secret as Flow Configurations which are going to be useful later.
Enter edit mode, go to the Flow Panel (left side panel) and click on the plus button next to Configurations. In the ID field enter the names of the configurations such as DG API Key and DG API Secret. For the values copy the Key and Secret as per steps in API Key/Secret.


Add Message as a Flow Input

Enter edit mode and add another Flow Input for User Message.


Add an AI Action

Click on the plus button at the bottom of the Greeting Template to add an action underneath it. On the activity panel, type in the Search "Predict Intent" and Select the Predict E-commerce intent v2 action. This will now be added to your flow.


Complete Activity Inputs

The AI action that we added takes in a number of inputs before it can run. You can see the inputs on the Activity Panel when the activity is selected: Region, DG API Key, DG API Secret, Message. Before we can save the flow we need to provide these inputs to the action. Expand each of the inputs and press select, then set the sources to the relevant Flow Inputs or Configurations. For the Region input you can select Constant Value and then choose in the dropdown the region your dashboard is in (EU or US).


Rename the Activity

Change the name of the AI activity to something shorter like "AI Intent" so it's easier for you to quickly see what's happening in the flow.


Run Flow

Now we can run the Flow again using the Play button and you can try it with different values for the Message Flow Input. You can try some e-commerce examples like "I haven't received my order", "what is the status of my refund?", "i need a new return label", "could you cancel the order asap" you should be able to see the intent predicted by the AI action.



After you click the Run button and get redirected to Tracker the flow might have not completed running and so you will need to reload the page to see the results.