Ever wish you could walk around the office with an army of robots to do your bidding?
Bumblebee, snap a photo of that whiteboard and make sure everyone gets a copy.
Sideswipe, find a good time for me to meet with Mike and Jason.
Jazz, stop pushing all the buttons in the elevator!
Okay, maybe actual robots would be impractical. Spark Bots, on the other hand, are the way to create machine accounts that can automate routine tasks and inject contextual content into meetings and group conversations.
Before diving in we should clarify some terminology:
If you're logged in to the developer portal, you should see the My Apps section. My Apps contains two concepts - Integrations, and Bots. Integrations are a way for your apps to request permission to invoke the Spark APIs on behalf of other Spark users. The process used to request permission is called an OAuth Grant Flow, and is documented in the Integrations guide.
Bots differ from Integrations in that they appear as their own users and post content on their own behalf. In group rooms, Bots are listed as People and are in many ways just like regular users.
Creating a Spark Bot is super easy. From the My Apps section, click on the plus sign and choose
Create a Bot from the wizard. You'll be asked to provide some basic information about the Spark Bot: display name, username and icon.
Keep in mind, all of these fields are end-user facing so make them as descriptive as possible. Only the bot's "first name" will be shown when it is mentioned, so try to avoid spaces in the display name.
Once you've filled out the registration form click
Add Bot and if everything goes smoothly you're all set!
Bots come in all different shapes and sizes. Some common types are:
Notifier bots typically respond to events in external services and post a summary in Spark. For example, a
GitHub Bot may listen for commits on a particular repo and post the committers name and comment into a team room set aside for this purpose. Or a
Deal Bot that lives in an account-specific room and posts updates from a CRM along with relevant news about the company like a product launch or earnings report.
Controller bots act as a text-based remote control for external services. For example, a
JIRA Bot may allow software engineers and product managers to control or query information from the popular bug tracking system JIRA, all from the comfort of a Spark room.
Controller bots are generally passive, waiting for someone in the room to issue a command. In group rooms, bots can only see messages in which they are mentioned (1:1 rooms bots can see all messages as they are automatically "mentioned"). Your users are required to mention the bot preceding the command like
@jira find WEBSITE-22 where
@jira is the bot's name.
Virtual assistants are the holy grail of chatbots. At a minimum, an assistant will understand natural language, allowing the user to ask it questions as they would to a human.
Recent advancements in NLP (Natural Language Processing) have made this not only possible, but quite accessible to the average developer. Most notably, Google launched Google Cloud Natural Language API in the summer of 2016, providing syntax parsing, sentiment analysis and deep noun classification.
Responding to natural language is a good first step but a truly exceptional assistant bot will be conversational, using past interactions to contextualize the most recent query. This is a very complex problem domain; luckily there are companies like API.ai providing a conversational platform built specifically for chat bots.
One key difference between Spark Bots and regular users is that, in group rooms, bots only have access to messages in which they are mentioned. This means that
messages:created webhooks only fire when the bot is mentioned in a room.
GET /messages requires that you specify a special
?mentionedPeople=me query parameter.
GET /messages?mentionedPeople=me&roomId=SOME_INTERESTING_ROOM Authorization: Bearer THE_BOTS_ACCESS_TOKEN
Keep your eyes on our blog for updates and other community-supported tools!