How to Use Wait for Action

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 design canvas:


After that, you will need to click on the action to configure its needed parameters, you will need to put a timeout, the connection of the next coming action, and the fallback action.

After timeout finishes the action will fallback automatically, and during that time a message should be received from outside to push the bot to continue. If fallback is configured with a number of tries so the action will keep sending an error message for any user input until the tries finished then the action will fallback.

Use Cases
There might be several use cases to explain how that might work and what it solves. We published a use-case/example on the following to give some ideas:
Shipment/Same Day Delivery
Ask end-user for a feedback on same-day delivery of grocery
a. MindBehind lists products
b. The user picks what to buy via sending a message
c. MindBehind handles transactions via payment action
d. Mind Behind waits for an action from your store to send the user info about the delivery
d.1. Wait for action gets triggered by receiving an HTTP request
d.1.a. Received HTTP request with parameters explaining that the order shipped successfully
d.1.a.1. MindBehind sends a message to the end-user with parameters belonging to information about finalized delivery such as the delivery guy's name and delivery finalization date-time that is gathered from the HTTP request. ( see: Behavior)
d.1.a.2. MindBehind asks the end-user to enter a rate point for delivery service
d.1.a.3. User rates delivery service by sending a message
d.1.a.4. The conversation ends
d.1.b. Received HTTP request with some parameters explaining that the order cancelled for some reason
d.1.b.1. MindBehind sends end-user a message that says "The delivery is canceled for some reason, like no stock for that product and the amount has been refunded from store side"
d.1.b.2. MindBehind returns conversation back to a. again or end the conversation according to the user input
d.2. Wait for action gets timeout, which means fallback without parameters specifying the reason behind that
d.2.1. MindBehind sends message to the end-user that says sorry for being late
d.2.2. MindBehind sends HTTP request to the delivery service API to check delivery status and leave a warning alarm for regarding delivery via the integration module.
d.2.3. MindBehind sends messages to end-user about the current status of delivery considering data that is gathered from the integration module.
d.2.4. MindBehind returns conversation back to d. again.
 
Best case scenario for use-case : Order gets delivered until wait for third party module gets timeout
At (d), its expected that the delivery guy brings goods to end-user and clicks finalize delivery button on his application.
Finalize delivery button executes an HTTP request (d.1.a.) to MindBehind for triggering wait-for-action module with some parameters such as delivery guy's name and delivery finalization date-time. Whenever wait for an action module receives the HTTP request, the bot might move further with gathered parameters from received HTTP request. (d.1.a.1.) At this point, wait for action module has done its job. So we might move further with required-desired scenario as d.1.a.2,3,4.
Worst Scenario for use-case : Wait for action gets timeout before order gets delivered. Wait for an action has timeout parameter that is configurable on it. You can create such scenarios related with possible timeout occurrences on your business - way of work. In this use case, delivery might be get late, we might send an apologize message, check current status of delivery by using integration action to send HTTP request and gather information from response to send an informative message to end-user.

Behavior

Wait for action will wait for specific type of message "THIRDPARTY" and will display an error message for other types of messages until fallback. You can send a message from your system outside to our system using the following info:

  • Messaging URL: https://app.mindbehind.com/external/v1/conversation/<Your channel id>/send
  • HTTP Method: POST
  • Required Header : “apiToken” that can be generated after creating the channel
  • Body: Should be in JSON format with the following schema:
    • clientID: The channel client id of the user that is stopping on this action waiting to continue.
    • content:  It should be a stringified JSON object that has the following schema:
      • params: New params to be pushed to the current state, it should be a Javascript map of key-value pairs, like {key1: value1, key2: value2}
      • modules: Some messages that should be sent to the user after the integration action, it should be an array of message object, to know more about the messages format and their properties please visit the next article: https://www.mindbehind.com/knowledge/messages-format
      • fallback: If it was true, it will make the integration action to fallback

And the flow will continue using the action connection normally. In the case of the fallback set to true the action will fallbacks. Also after the timeout is passed the action will also fallback passively through incoming "THIRDPARTY" message with fallback being set to true.

Defining a delay for this action will only add a delay until the action actively began to wait for "THIRDPARTY" message or any other message.

You can download from here our Postman collection to try that request right away.


    • Related Articles

    • How to Use Selection Action

      Action usage Selection action is used to send a bot selection message to the user. The selection may be through cards, buttons, or keywords by mapping the user response to one of them. You can choose optionally a name for your Selection action, and ...
    • How to Use AI Action

      Action usage AI action helps user to create a comprehensive conversation without too much effort. MindBehind supports three AI providers: Google DialogFlow, IBM Watson, CLU and Microsoft Luis. After connecting to a provider, the page fills up with ...
    • 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 ...
    • How to Use Human Action

      Action usage Human action is used to handover the conversation to the live agent. The handover configuration is defined for each channel in the channels section when you navigate to your company profile page. So to use this action its enough just to ...
    • How to Use Bot Action

      Action usage Bot action is used to forward the message to sub bot to achieve re-usability and to build up simple and clear bots. You will need to drag and drop it to your assistant canvas (or simply click on it from actions menu): Then you will need ...