YelpBaaS Bot

ServisBOT BaaS is the home for mappings between the ServisBOT platform and external services such as APIs and SDKs. The easiest way to see the power of a BaaS is build one using our out-of-the box blueprints, and build a demo bot.

Blueprints can contain more than just one ServisBOT bot building block. There are blueprints for just BaaS items, or just bots with workers, and then there are also blueprints with all three.

Yelp Search BOT

In this example we will guide you through the steps to create and test a Yelp BaaS API connector, then extend a basic classic flow conversation with it.

Requirements

Build a Classic Flow Bot from Blueprint

  1. Go to the Bot Army tab
  2. Click on Create BOT
  3. Select the “Classic Flow Bot Blueprint”
  4. Name this bot RestaurantBot
  5. Enter anything for the description
  6. For the welcome message, we want to let the user know that this bot can help them find a restaurant Hi, how can I help?
  7. Click create
  8. If building was successful, click complete.
  9. We will come back to this area later.

Build a Yelp BaaS from Blueprints

  1. First set up your secret, containing your API Token
  2. You’ll need to create a Yelp Fusion API keys
  3. Go to Secrets Management in portal
  4. Click Create
  5. Select Token Auth as your Secret Type Template from the creation page
  6. Replace APIKEY with your Yelp key
  7. Hit save
  8. Time to move on to creating the API Connector
  9. Go to BaaS API Connectors
  10. Click on Create
  11. Select the Yelp Business Directory
  12. Enter an Alias for the connector. Suggested businessSearch
  13. From the secrets dropdown, select your recently created secret
  14. Create Connector will save all of your settings into the platform.

Wire up your bot to the BaaS

  1. Go back to the Bot Army section of portal and find your bot.
  2. Click on your RestaurantBot
  3. On the bot’s detail page there will be a button up at the top labeled Designer which will take you to the Classic Flow canvas.
  4. Your Flow will start off looking like this:

  1. We will begin by editing the purple prompt node

    1. Double click the purple node
    2. Add a new option for Find me a restaurant, restaurants
    3. After clicking done, there will be a new 5th output on the node
  2. Drag and drop a BaaS node onto the Canvas

    1. Name it yelp business Search

    2. Edit the context fields

    3. Connect up the fifth output to the BaaS node

  3. Process the ResponseMapping

    1. Drop a function node onto the canvas
    2. in the function body assign the BaaS response to a messenger variable
msg.payload.foodPlaces = msg.baas.businessSearch.response.businesses;
return msg;
  1. Set up the markup template. We will use a carousel to display the yelp template.
    1. Drop the Template Node on to the canvas
    2. Edit the node
      1. Set property to msg.foodPlaces
      2. Set Format to Mustache Template
      3. Set output to Plain text
      4. add in the following markup.

Setup the return message and finish wiring

  1. Drop a markup node onto the Canvas

  2. Name it, and edit the message to be msg.foodPlaces

  3. Wire the output to the back to the prompt node

  4. Deploy and test

    1. Click Deploy in the canvas and navigate back to the bot pages
    2. From the bottom of the test page you can open up a preview window.
    3. Now when the bot displays the menu, you can select Find me a restaurant, the bot should send you a list of restaurants in a carousel.