Last week Facebook launched its bot-enabled Messenger Platform. I decided to check it out and build a simple Salesforce bot for Messenger. This is not an official project, just a quick experiment to explore the possibilities.
Watch the video to see the bot in action:
or using the phone version of Messenger:
Bots allow you to access information in an unstructured manner, using natural language, and from wherever you happen to be without having to switch context and load a dedicated app.
Part of exploring the new possibilities enabled by bots is going to be to identify the right use cases; what should be botified and what shouldn’t. This particular bot is a proof of concept that lets employees access their customer information and perform quick actions in a conversational manner. The Facebook Messenger platform is more focused on Customer Engagement use cases, but the approach used in this example to build a simple Salesforce-powered bot remains the same regardless of the specific use case.
Source Code
The source code for the Node.js application is available in this repository. The easiest way to deploy your instance of the Node.js App is to click Deploy to Heroku button below, and fill in the deployment wizard. You need to provide the access token of your Facebook Webhook, the id of your Salesforce connected app, the username and password of an integration user in Salesforce. If you are testing this in a Developer Edition, you can enter your own credentials.
- Make sure you are logged in to the Heroku Dashboard
- Click the Button below to deploy the application on Heroku.
Your own instance of the application is automatically deployed.
Check out the Messenger Platform documentation to create a Facebook-side of the application.
Authentication
This sample bot uses an “integration user” to connect to Salesforce. In other words, all Facebook users connect to Salesforce using the same Salesforce user. In a production environment, you’d probably want to map Facebook user ids to Salesforce user ids so that requests coming from a specific Facebook user can be served using the associated Salesforce user.
Pingback: A Bot Toolkit for Creating and Deploying Bots Inside Salesforce - Developer Relations()