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.
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.
Bot Army
tabFrom Blueprint
RestaurantSearch
Hi, how can I help?
Finish
.Secrets Management
in portalCreate Secret
Token Auth
as your Secret Type Template from the creation pageAPIKEY
with your Yelp keyIntegrations
Create Connector
and from the dropdown menu From Blueprint
Yelp Business Directory
businessSearch
secrets
dropdown, select your recently created secretCreate Connector
will save all of your settings into the platform.Bot Army
section of portal and find your bot.RestaurantBot
Designer
which will take you to the Classic Flow canvas.We will begin by editing the purple prompt node
Find me a restaurant
Next Worker
node as the bottom node is
specifically for when a user types instead of choosing an option.Drag and drop an apiConnector node onto the Canvas
Name it yelpBusinessDirectory
Edit the context fields
Connect up the fifth output from the prompt node to the apiConnector node
Process the ResponseMapping
function node
onto the canvasmsg.payload.foodPlaces = msg.apiConnector.yelpBusinessDirectory.response.businesses;
return msg;
<TimelineMessage>
<List title="Select a restaurant" horizontal="true" selectable="true" style="large-icon" interactionType="event" preventRetries="true">
#foreach($foodPlace in $payload.foodPlaces)
<Item title="$foodPlace.name" subtitle="" id="$foreach.index" imageUrl="$foodPlace.image_url">
<Option title="Reserve" id="Reserve"/>
<Option title="Details" url="$foodPlace.url" urlTitle="See Restaurant Details"/>
</Item>
#end
</List>
</TimelineMessage>
Drop a markup node onto the Canvas
Wire the output from the interaction node to the input of the markup node.
Name it, change Source
to Message Object
and edit the message to be msg.foodPlaces
Wire the output to the back to the purple prompt node
Deploy and test
Deploy
in the canvas and navigate back to the bot pagesFind me a restaurant
, the bot should send you a list of restaurants in a carousel.