Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Easily Deploy your Chat Bot to Multiple Channels with Stamplay

1,110 views

Published on

Stamplay makes it easy to chain services and deploy to messaging platforms with little to no code. See how Watson Conversation can be quickly integrated into chat platforms such as Facebook Messenger and Slack.

Published in: Technology
  • Be the first to comment

Easily Deploy your Chat Bot to Multiple Channels with Stamplay

  1. 1. Giuliano Iacobelli, Co-founder / CEO g@stamplay.com Easily Deploy your Chat Bot to Multiple Channels with Stamplay Cooking time: 30 mins
  2. 2. Chat UX is more natural, dynamic and avoid any friction opening new accounts The ideal user engagement channel Messaging platforms aim to change the way brands communicate with consumers More than 900 million monthly active users only on Facebook Messenger In 2015 messaging apps have been the fastest growing In the global Top 10 of most used apps 6 are messaging apps No need to download yet another app
  3. 3. Ingredients The bot will be available on Cisco Spark and Facebook Messenger will use IBM Watson Conversation to handle natural language and will be implemented using Stamplay.
  4. 4. Create an account on Stamplay Go to https://editor.stamplay.com/signup and create your account for free
  5. 5. Create the project on Stamplay Once inside, click on the green “+” button in the upper right corner and select Start from Scratch
  6. 6. Create the project on Stamplay Type a name for your project
  7. 7. Grab your credentials from Watson Conversation Enter your Bluemix account get the credentials for the Watson Conversation service
  8. 8. Connect IBM Watson Converstion on Stamplay On Stamplay go to Dashboard > Integrations and search IBM Watson Conversation
  9. 9. Copy your Watson Conversation credentials Copy Username and password and then click “Connect”
  10. 10. Copy your Watson Conversation credentials Go to https://developer.ciscospark.com/apps.html and create a Bot
  11. 11. Fill basic info for your bot Icon URL https://dl.dropboxusercontent.com/u/397182/logo_white_512x512.png
  12. 12. Save the Access Token Once the bot is created you’ll see an Access token, copy it and save it somewhere
  13. 13. Connect Cisco Spark Bot on Stamplay On Stamplay go to Dashboard > Integrations and search Cisco Spark bot
  14. 14. Copy your Spark bot token Copy the Access Token you got before and then click “Connect”
  15. 15. Launch the Watson Conversation tool From your Bluemix account enter the Conversation service and click Launch Tool
  16. 16. Import the dialogue model Click the icon next to “Create” button and upload the dialogue model https://app.box.com/s/x4j6fb8036lasosl45blyv9ir9s9gluo
  17. 17. Dialogue overview: Intents A set of intents are used to return answers to known questions
  18. 18. Dialogue overview: Intents #when_it_burns intent handles questions like “what night does the man burn?”
  19. 19. Dialogue overview: Intents #when_it_is intent handles questions like “what are the dates for the event?”
  20. 20. Dialogue overview: Intents #where_is_it intent handles questions like “where is the festival located”
  21. 21. Dialogue overview: Intents #what_is_it intent handles questions like “what is the burning man?”
  22. 22. The Dialogue model An Start node of the dialogue tree handles the initial conversation
  23. 23. The Dialogue model Create a root node for each intent that can answer a question (e.g #what_is_it)
  24. 24. The Dialogue model Create a root node for each intent that can answer a question (e.g #where_is_it)
  25. 25. Inizializing the integration Flow Go to Flows and start by selecting the Cisco Spark bot app from the list
  26. 26. Configure the event that starts the flow We’ll start this flow everytime the bot receives a New Direct Message
  27. 27. Select the event that starts the flow Click on continue when you get to the Account tab, we’ve connected this before
  28. 28. Adding a steps to your flow After each step of your workflow you can define the following action by moving your mouse hover the + icon
  29. 29. Add a Contidion step to filter bot messages Spark triggers this event also when is the bot itself writing so we filter out its messages with a condition step that checks for the sender email address
  30. 30. Checking if the message is sent by the bot Click on the first dropdown on the left and select personEmail, this will be the property we use to recognize if is a bot writing (something@sparkbot.io)
  31. 31. If the condition is met stop the flow To run a branch of our flow only when the condition is met let’s add a step that will be executed IF TRUE.
  32. 32. Adding a Stop step After clicking IF TRUE, select STOP to add a step that will terminate flow execution.
  33. 33. Saving the Stop step Save the new step without any additional configuration and you’re good to go
  34. 34. Retrieve message content The New Message trigger of Spark only pass an ID of the message received without content. To read the actual message we add the Get Message action.
  35. 35. Passing data from step to step To use a Message Id from a previous step. Click on the “{}” button to see the steps available to fetch data from and select New Direct Message.
  36. 36. Passing data from step to step Click on the id attribute of the message JSON representation sent by Spark
  37. 37. Passing data from step to step Stamplay will add a parameter inside the input field and will automatically replace it with the actual value of the id of the New Direct Message that will trigger this flow
  38. 38. Passing the message to Watson Now that we have the message that has been type by the user we can pass it to Watson, add a new Action and select IBM Watson Conversation
  39. 39. Passing the message to Watson Select the only action available, Conversation
  40. 40. Passing the message to Watson Fill the parameters by passing the Workspace ID and the text. Workspace Id is available on the Watson Conversation tool home, text will be passed by the previous step.
  41. 41. Getting the Workspace Id On your account of the Watson Conversation tool you can find the workspace Id by entering the Workspace details
  42. 42. Passing the message to Watson Select the text attribute from the JSON representation passed by the Get Message action
  43. 43. Passing the message to Watson Stamplay will add a parameter inside the input field and will automatically replace it with the actual value of the text of the Get Message action
  44. 44. Returning the answer to the User The last step of our flow is to return the answer computed by IBM Watson Conversation. Add one more action and select Cisco Spark Bot Post Message action
  45. 45. Returning the answer to the User The Room dropdown shows us all the room where the bot is currently available. Click on Type a custom value to be able to pass here a dynamic value
  46. 46. Returning the answer to the User Once che cursor is blinking, click on the “{}” button to grab a valid Room Id from the New Direct Message step of this flow
  47. 47. Returning the answer to the User Select the roomId attribute from the JSON representation
  48. 48. Returning the answer to the User Text field will be filled by passing the result returned by IBM Watson Conversation, once again click the “{}” button to open the dropdown with the previous step of the flow
  49. 49. Returning the answer to the User After selecting IBM Watson Conversation select the text attribute nested under output
  50. 50. You’re all set The final flow should look like this, make sure it’s on by checking the switch
  51. 51. The Data Model
  52. 52. Connecting your Facebook Page
  53. 53. Connecting your Facebook Page
  54. 54. Creating the integration Flow
  55. 55. What starts the flow (trigger)
  56. 56. Configuring Webhook URL on Facebook
  57. 57. Configuring Webhook URL on Facebook
  58. 58. Configuring Webhook URL on Facebook
  59. 59. Lookup for existing conversations
  60. 60. If conversation not found..
  61. 61. ..get info about user profile..
  62. 62. ..process user message with Watson..
  63. 63. ..save new conversation record..
  64. 64. .. and reply to user on Facebook Messenger
  65. 65. Giuliano Iacobelli g@stamplay.com Thanks!

×