How Heymarket Built Text and Facebook Messaging for Slack

As a small team of developers, we’re avid Slack users. We live in the app each day updating team members, requesting feedback, and planning deploys. One of the only times we leave Slack is to message with customers. We wanted to change that, so we integrated our own app, Heymarket, into Slack. We can now track customer support text and Facebook messages within a dedicated Slack channel. We took it a step further and now track text messages from new sales leads in a separate Slack channels.

How our Slack Integration Works

Our Slack integration was designed for engineers, managers, and other people who use Slack as their predominant chat app.

The integration routes messages from a Heymarket shared inbox to a corresponding Slack channel. Replies to the thread are sent back to the contact as a normal text or Facebook message. We even added Slack action buttons to provide some business messaging productivity features such as assigning and closing a chat.

Threaded Conversations Keep Channels Clear

A conversation in Heymarket can spawn multiple messages and there may be hundreds of conversations per month, week, or even day. The goal here is to consolidate messages in a single thread so that they do not clutter Slack channels. This was made possible with threaded conversations. Threads also provide all the necessary background of a chat, including images, without having to scroll through an entire channel.

After linking Slack with a Heymarket inbox, then on any incoming conversation creates a Slack thread and associates it with Heymarket chat using the`thread_ts` timestamp. During the Slack thread creation, we propagate relevant information about the Heymarket chat such as name and phone number.

`{     "text": "Conversation with <Name|Phone>",     "attachments": [         {             "title": "Click to view all messages with <phone>",             "title_link": "https://app.heymarket.com/chat/id", "text": "Note: Replies to this thread will be texted to new contact in real-time",             "callback_id": "heymarket_chat_id",             "attachment_type": "default",             "actions": [                 {                     "name": "assign",                     "text": "Assign to team member",                     "type": "select",                     "data_source": "external"                 },                 {                     "name": "archive",                     "text": "Archive",                     "type": "button",                     "value": "archive"                 }             ]         }     ] }`

Once a Slack thread is created, anyone in the channel can reply to a customer without actually being a user in Heymarket. On the Heymarket side, any messages that come from Slack are marked appropriately.

Heymarket Reply to a Thread in Slack

Rendering

For chats that have images in them, it was key to render them appropriately in the Slack channel. Especially to preview them and allow for replies in the Slack thread.

We used the image_url attribute in Slack message attachments which renders images in the format and size required to fit into the message thread.

{
  "attachments": [
    {
      "title": "Some text",
      "image_url": "https://app.heymarket.com/image_path/img.jpg"
    }
  ]
}

Actions

One of our goals at Heymarket is to help business users get to inbox zero for messaging. That means helping them organize chats by setting reminders, assigning chats, and closing them.

With Slack actions we were able to expose the Heymarket close feature in Slack channels. Closing chats removes them from the Heymarket inbox, while still being able to search for them later.

Actions allowed us to easily insert an “Close” button so that you can clear your Heymarket inbox right from Slack.

When we were creating Slack thread from above, we used Slack’s `callback_id` property to keep a reference to the Heymarket chat. So when Close is clicked in Slack, Heymarket knows exactly which chat to close.

Message Menus

Heymarket shared inboxes provide the ability to assign conversations to team members to control notifications and triage requests. With Slack Message Menus you can simply select a team member and assign the message to them. We used Slack’s callback_id to find out who are the members of Heymarket inbox and present an Assignment button in the Slack thread.

The Quick Path to Slack Integration

We were able to leverage Slack’s well documented APIs to build this integration in just one week. After internal usage, we were able to add support for Actions and Message Menus in less than a day. We added Facebook Messenger integratino to Slack in one more day. With that, Heymarket provides a consolidated, shared inbox for all relevant business messages.

This is just the beginning, stay tuned for more integrations to come.

Share via
Copy link