Facebook's Work Chat

20 November, 2019
Back

Facebook has a corporate social media version called Workplace. Work Chat is the Messenger version of the app.

Like Facebook, employees would have unique accounts for themselves - usually created using their corporate email address. When employees are newly hired or resign, their accounts are maintained on the company's active directory.

fb-workchat

@unsplash

Now, here comes the fun part. Having a tool like that allows teams to get creative. They may want to use Work Chat to replace email notifications, reduce SMS cost, upload travel receipts and everything else you can imagine. You don't typically think of these things when you're using Facebook because it's just a news feed.

Naturally, getting these requests to enhance Work Chat, you'd have to look through Facebook's developer docs. It's very well documented, but it still can get overwhelming at times. So here's the breakdown.

Integrations

Workplace has two types of integrations:

Third party apps - Your company is a FB partner. But the vendor's application you're sending notifications from is not. You'd integrate it as a third party app. This process is a bit more stringent because FB would screen the app before approving it.

Custom integrations - You as a FB partner can build apps and benefit directly from FB's APIs. Say HR wants to send Work Chat messages to employees every month end about their salary. FB won't have an issue with you hooking the payroll system up to Work Chat - again, as long as it's not a vendor system.

IDs

Workplace ID - Every user has a unique identifier, the workplace ID which is also often tied to their company email. If my boss wants to message me, he'd type in my name in the search box. What's really happening is, Workplace is looking for my unique id so that the message doesn't go to another Matthew Yong.

Thread ID - This is the ID of the conversation between two or more people. If Mark is talking to Jessica, the chat would have one thread id. If Mark is in a group chat with his team, that chat also has one thread id.

APIs

Graph API - This is how Work Chat receives and send data. The idea of the graph is that everything has a heirarchy it can be traced back to. A post, has a member, which belongs to a group.

Send API - Allows the bot to send messenges to any Workplace ID.

Other components

Bots - A program that replies users automatically is a chatbot. They have no keyboard, so they use the Send API instead.

Webhook - Webhooks are like a doorbell. It monitors for changes in the Workplace. It detects incoming messages, notifications, and seen messages. For example, when a user opens a message, webhooks changes the message status from unread to seen.


Let's put it all together. Now corporate affairs wants to automatically send news snippets from an internal news portal to employees through a bot. How would all the pieces fit together?

The chatbot would be built in the news portal. Every time there's a piece of news, the bot would look for the relevant employee's Workplace IDs and send the message to the Thread ID through the Send API in the Graph format. If for example, a particular employee replies, 'tell me more!', the webhooks triggers the chatbot to send more news.


Back