Conversing with AI on Slack

How we established conversational rhythm on Slack’s API

People who interact with our AI scheduling assistants Amy + Andrew are often surprised to learn they’re not humans, and we didn’t want to lose that element of their character by bringing them into Slack.

We’ve spent the past four years perfecting our AI’s ability to work in an email context, so every time you CC Amy + Andrew, they reliably set up a meeting based on your personal requests. Their ability to do their job comes from their natural language recognition, which gives them a more intuitive sense of conversation and linguistic flexibility than many bots.

Our users have become familiar with the rhythm of conversing with Amy + Andrew over email:

When we decided that we wanted Amy + Andrew to work over Slack as well, we knew we’d have to account for a very different conversational rhythm — one that’s more free-flowing and instantaneous. That speed makes Slack hugely appealing for scheduling meetings as soon as the impulse surfaces, but the interface presented challenges to our preexisting response time and cadence, which in turn affects our code. We had to solve the problem of letting Amy + Andrew work on their scheduling while also keeping up with a Slack discussion.

If you’re looking to build in the Slack interface, your app should follow the conversational rhythm of the platform, especially if you provide a service that is an extension of the conversation’s flow (like scheduling a meeting).

Here are a few pointers from our development team on how we accomplished that.

Forecast against Slack’s response protocols

Slack’s API groups responses into two categories: Instant responses must occur within 3 seconds after a slash command, or they need to be be routed to a response_url. The latter category can send users up to 5 messages within the next 30 minutes.

Our Full-Stack Engineer Holden McGinnis recommends forecasting against those constraints to avoid future problems.

“Initially, we built our application to just respond to users immediately,” he recalls, “but then we considered database latency or errors from other production systems and realized we should build a contingency into the delayed response categories as well. It would have been easier to forecast for those ahead of time.”

Developers can avoid headaches by first wrapping their heads around those two response categories, and strategizing how each one should be used in their approach.

Consider possible conversational routes

When building a conversational Slack app, consider the pacing of messages and how your functionality can seamlessly integrate into it. Email is a slower, more controlled communications platform, which can make the “shape” of conversations more predictable for services like ours.

Typically, users are more patient between email exchanges. For Amy + Andrew, that gives them a bit more time to negotiate their incredibly complex tasks. Conversations in Slack unfold differently.

Teams on Slack don’t want to lose momentum while in a burst of inspiration, so we considered how Amy + Andrew could function with that added level of urgency.

“We landed on two different patterns for this: an instant response for our base case and a confirmation message that could be delayed if necessary,” recounts Dave Mills, our Sr. Software Engineer. “Usually they are both sent instantaneously, but if for some reason they’re not, we can keep up with the flow of the Slack discussion and circle back with more info later.”

The instant response indicates that Amy + Andrew have received the initial request and are on the job. They then process additional meeting details, sort relevant phrases, account for potential typos (shoutout to Levenshtein distance, which we incorporated into our code for that) and set up a meeting. Once the meeting information has been correctly routed, users get a private ephemeral message that serves as a “meeting receipt” of sorts (the red text in the GIF above).

When two x.ai users are using the Slack app, this “receipt” is usually instantaneous, but if our app is thrown a potential curveball (say, a new user), they can delay the receipt message and still alert meeting participants ‘in_channel’ that they’re working on the request, so nobody skips a beat.

Taking a two-pattern approach also informed our decision to build an “/amy meetings” command into our Slack app, which lets users view a private list of their recently scheduled meetings, as well as meetings being worked, on without leaving their Slack channel.

This functionality also has a delayed response, so Amy sends an “I’m working on this but need a second” message after a 2.5-second timer expires.

Slackify your AI’s language

Amy + Andrew get mistaken for human often because they have such a carefully crafted tone of voice – one that we wanted to preserve while making it more Slack-friendly.

After settling on the two-pattern approach, we wanted to make sure the literal words Amy + Andrew responded with also didn’t distract from the conversational rhythm.

“I added emoji so that it’s a little more casual, which adapts to how people talk on Slack. Amy would rarely do that in email,” explains Diane Kim, our AI Interaction Designer, “and in some instances I also tweaked word choices or shortened language to better illustrate what she’s doing and fit with how people speak on Slack.”

Diane also points out the need to use more specific, instructive words in the app’s welcoming message.

“In email, Amy is pretty verbose and customers can be too. There are all sorts of ways to ask Amy to get to work scheduling a meeting. On Slack, the parameters narrow a bit at least to get things started; for example, you have to use the slash command to wake Amy up (/amy please schedule a 1:1 with @holden”

Because each communications channel has its own vernacular, it’s important for AI interaction designers to be an integral part of translating an AI’s personality into that new context.

For x.ai on Slack, this meant adding a playful touch to Amy + Andrew’s responses and making sure users know the simple slash command for waking their AI assistant up.

We love our new Slack app and hope you’ll come explore. Tweet or email us if you’d like to learn more and we’ll have Amy set up a meeting!