Teneo Developers

Convert a Composer bot

Finish off flow

Now we can finish the flow by calling the new integration and adding more functionality.

Extract the user's postal code

We need to make sure we are actually extracting and storing the postal code given by the user.

  1. Go back into the flow you created earlier.
  2. Under the output node, click on the Plus icon, followed by Continue with and Transaction.
  3. The transition between the output node and the new integration node should now be selected; give it a name such as Extract postal code.
  4. In the After Match section, add an After Match for Entity.
  5. Paste in NUMBER in the Entity field.
  6. Click on Add Mapping below the Entity field. Using the drop-down menus below, select the source nNumber and the target postalCode.
  7. In the Match section, add a Match for Entity.
  8. Paste in the Entity NUMBER.

Add the integration node

Now we can set up the call to the integration in the integration node we just added.

  1. Underneath the Extract postal code transition, click on the Plus icon. Select Continue with, followed by Integration. Choose your new Weather integration.
  2. Give it a name like Get weather.
  3. Now you will need to specify which variables should be used for the information you send to or receive from the integration. First select the drop-down menu in the Send section and select the variable postalCode.
  4. Select the appropriate variables for all of the drop-down menus in the Receive section. These are the response code, celsius, city, country, fahrenheit, icon, and weather variables that you created earlier.

Summarize weather

Let's finish off the structure of the flow to send the weather results to the user.

  1. Click on the Plus icon underneath the integration node.
  2. Click on Match, followed by Script.
  3. Paste in the evaluation script responseCode == 200.
  4. Give the transition a name like Success.
  5. Select the output below the Success transition and give it the name Summarize weather.
  6. In the output node, paste the answer The weather is ${fahrenheit}°F or ${celsius}°C and ${weather}..

Add a fallback transition

Finally, let's add a fallback transition in case the bot does not manage to successfully retrieve the weather based on the user's input.

  1. Select the integration node and click on Output in the ribbon bar.
  2. Give the output node the name Something went wrong. Reuse the same text for the output answer.
  3. Click on the transition above the output node and give it a name like Failed.
  4. Hit 'Save' and close the flow.

Next page
Test your bot
Was this page helpful?