How to Use the Integration Action for Non-developers

How to Use the Integration Action for Non-developers

Why do we need the Integration Action?

Virtual assistants are there to provide information and guidance for the user. The knowledge of the assistants is, however, limited to the conversation itself. When virtual assistants are incapable of providing the functionality or information the user expects, they need to consult another source of information.

If the user requests something that can be neither known beforehand in the design stage of the assistant nor deduced from the ongoing conversation, then that's exactly where you want to include the Integration Action as a mechanism to help.

Take the example of a conversation where a user asks the date of today. Since dates change every day, it would not be wise to go to your flow and write the date of the day on your map each day.

The date of the day cannot be deducted from the content of the conversation either.

In the end, without an Integration Action, virtual assistants would be incapable of answering the question. (or, again, you can have a conversation designer that updates the date of "today" each day in your map...but how sustainable would that be?)

Suppose that, as a human being, you cannot recall the date of today. How would you find it? You would probably google it to find out.

That's exactly what virtual assistants do with an Integration Action. The Integration Action finds the date and transfers the information to the chatbot for it to reply properly.

Where is the Integration Action used?

As a general rule of thumb:

  • If the action that virtual assistants are required to take cannot be predetermined,
  • And must be calculated in the course of the conversation,

then you probably need to use the Integration Action.

Here is a non-exclusive list of common cases where the Integration Action is used:

      👉 Making mathematical calculations,

      👉 Resetting the state of the assistant, i.e., clearing the parameters the assistant gathers throughout the conversation,

      👉 Finding out something that pertains to the user, such as finding the user's order.

How does the Integration Action work?

In a nutshell, the Integration Action works just like how any other link on the Internet works.

Quick Overview of Data Exchange Between Two Sides on the Internet

When you click on a link or enter the link in your browser (e.g. Chrome), the page loads with a bunch of information.

So, what happens here is that you request the web page for a resource, say a tweet, and the service that is located somewhere on the Internet responds to you with the actual tweet.

This is what is referred to as the 'client-server model,' which means that there are two sides to communication. One side plays the role of the requestor, and the other side plays the role of the responder.

Let's delve into the Client-Server Model in more detail. It is the client that initiates the communication, and it is the server/service that fulfills the request and returns the information about the process or the result. For all this to work, the requester and the responder, i.e. the client and the server, need to understand each other.

There are predefined protocols for transmitting information between two parts, just as we have rules for using language.

The protocol that is most commonly used on the web, and in the Integration Action as well, is the Hypertext Transfer Protocol (HTTP).

So, what is left to us is to understand the basics of HTTP. If we go back to the tweet example, there are multiple actions that we might want to perform on a given tweet. We might simply want to get the content of the tweet. We might create a new tweet, edit it, or delete it. So we have at least two ingredients here:

  1. The action we want to take (The HTTP Method)
  2. The resource on which the action is to be performed. (URL)

Let's dive into what they mean:

The action we want to take (The HTTP Method)

The intent of our action, i.e., reading, creating, editing, or deleting a tweet, corresponds to what we refer to as the HTTP Method.

Here is a list of the most commonly used HTTP Methods:

HTTP Method

When to Use

GET

When you want to get the information
POST
When you want to create a new resource
PATCH

When you want to modify some part of the resource that already exists

DELETE
When you want to delete the resource


In the tweet example, each HTTP Method would be:

  • GET: Reading the tweet
  • POST: Creating a new tweet
  • PATCH: Editing your tweet
  • DELETE: Removing the tweet from your profile

The resource on which the action is performed (URL)

The actual link on the Internet that we want to act on. For example, 'http://google.com'.

Okay, but where do you specify the method when you type out the URL on the browser and hit enter? The browser itself does that on your behalf. It always performs a GET request.


For example, when you enter http://google.com, you issue something like this: `GET http://google.com.`

How does it relate to Integration Action?

Long story short, when you need to use the Integration Action, you must follow the HTTP protocol. And just as explained above, at least two ingredients are needed to do so:

  1. URL

    You need to provide the URL, i.e., a link that starts with http://. Think of it as sending someone a letter. 📨 You will need an address that uniquely identifies the receiver so that the postal office will get to know where it needs to send the letter.

    There is no way to predict the URL beforehand, thus you need to ask the developer who is responsible for creating the required service.

  2. Method

You also need to specify the method. You need to get this information from the developer as well.

But now suppose that you want to create an order.

The method should be "POST" since you will be creating a new order. However, you need something additional to create an order, and those are the order details such as who ordered what.

For POST and PATCH methods, we need additional information.

Well, since your assistant cannot do this part by itself, what you need here is to ask the details in the assistant & forward that information to the Integration Action.

What we want here is to ask the user some questions, and then request the Integration Action to create the actual order by providing the user input.

Let's say that you need the user's name, surname, phone number, and shipping address to create a new order. The assistant needs to send these pieces of information to the Integration Action for it to create the order using the information given.

For example, you can add an input action with the following question:

What is your name?

You also need to name the parameter using the user interface that the Input Action provides. Let's say you write firstName.


When the user answers your question, say, as John, then firstName will be assigned as John.







You can test this in MindBehind's "Preview" section. Once the "eye" logo is on 👁️, you can see every parameter and how they are assigned.



For many Actions in MindBehind, you can use the pound/hash (#) symbol as a placeholder for the parameter. In this example, when the virtual assistant replied with a "Hello John! 👋" to the user, it is seen as "Hello #firstName! 👋" on the map.








You need to do a similar thing for the surname, phone number, and shipping address as well. Let's say that the parameter lastName determines the surname, phoneNumberdetermines the phone number, and shippingAddress specifies the latter.

Some examples to name the parameters: nameOfTheDay (camelCase) name_of_the_day (snake_case) NameOfTheDay (PascaleCase)

Here, the Integration Action needs to know what you named the variable that corresponds to the user's phone number as well as the shipping address.

The developer and the conversation designer need to predetermine the names of the parameters and their meanings beforehand so that they both know where to look when exchanging information.

This is also true when it is time for the Integration Action to return to the assistant. The virtual assistant might want to know the ID of the order, and whether it was successfully created or not. So, again, the developer and the designer need to determine the names of these variables.

Flow

  1. The designer decides that the action they want to perform cannot be achieved by the virtual assistant alone.
  2. The designer asks the developer to create a service to perform that action on behalf of the assistant.
  3. The designer & developer decide on the requirements of the action, i.e., what inputs are needed, and what the output will be, and how they will be named.
  4. The developer creates the service and provides the URL, Method, and how the service will behave when the inputs are not received as expected.
  5. The designer uses the Integration Action as described by the developer. The virtual assistant stops the execution of the flow when it hits an Integration Action, and waits until the response is received back.
  6. According to the design of the map, the output of the Integration Action might be followed with a Logic Action.


    • Related Articles

    • How to Use Integration Action

      Action usage Use the integration action when you want to call an HTTP integration endpoint to achieve some custom business needs. You can process the parameters saved during the life cycle of the assistant, and either only store them out in some ...
    • How to Use Zapier Action

      Action usage Zapier action is used when you want to integrate MindBehind with other famous platforms onlinei thanks to Zapier wide market. This action will send the current assistant state to Zapier for any custom further actions you want to do with ...
    • How to Use Wait for Action

      Action usage Use the wait for action when you want to control the assistant behavior from your outside system. The story begins by drag and dropping (Or simply clicking on) the Wait for action from the Actions menu on the left side of your assistant ...
    • How to Use E-Commerce Action

      First of all, to use this action you need to integrate your store to MindBehind. If you haven't done that yet, please check the integrations section under company settings and if you need any further help, please check our article about e-commerce ...
    • How to Use Logic Action

      Action usage Logic action is used when there is a conditional flow depending on the value of parameters in the current state. And logic action can contain multiple conditional units but always will use the connection of the last conditional unit ...