A note from 2026: This article was published in 2016. The hybris brand has since been replaced by SAP Commerce Cloud, and Meta/Facebook Messenger Platform APIs, plugins, and messaging policies have changed significantly; review the current Meta Messenger Platform documentation before implementing a similar integration.

Introduction

This spring, Facebook launched the Messenger platform, making it possible for developers to connect their systems with the more than 900 million people around the world who use Messenger.

By default, hybris uses email communication as the only channel to communicate with customers. However, channels such as Messenger or SMS are very reasonable for e-commerce because they make the customer experience nicer and more convenient.

Messenger allows customers to communicate with an online store quickly and effectively, without the delays associated with email.

In my PoC, when a customer makes a purchase, the conversation begins via Messenger. The customer receives a notification that is delivered instantly. I demonstrate that automated updates are sent directly to customers through Messenger, allowing them to track order status and ask questions all in one place. Messenger makes it easy to answer questions about orders and invite your customers to check out related products.

Basically, Messenger can easily be replaced with any other IM software that has an appropriate API:

Solution

In the video, I demonstrate the following:

Video

Limitations

We get page-scoped user IDs from Messenger, so we can’t match existing users with their app-scoped user IDs, even though we are using the same FB App for Facebook Login and Messenger Bot integration. There are some ways to match Messenger users and Facebook users, but they are outside the scope of this topic.

Facebook Documentation: The ID must be an ID that was retrieved through the Messenger entry points or through the Messenger webhooks; for example, a person may discover your business in Messenger and start a conversation from there. These IDs are page-scoped IDs (PSID). This means that the IDs are unique for a given page. If you have an existing Facebook Login integration, user IDs are app-scoped and will not work with the Messenger platform.

There are rate limits in Facebook Messenger to prevent malicious behavior and poor user experiences. Direct advertising is not welcome. If you send upsell or cross-sell offers, you may expect some consequences if customers make a complaint.

There is a length limit for text messages. The messages must be UTF-8 and have a 320-character limit.

Technical details

Facebook Messenger integration diagram

Webhook is a module that serves as a listener for Facebook requests. Once the customer sends a message, Facebook makes a request to the Webhook module. This module sends responses as well.

When the customer enables order updates by clicking the blue button at the final step of the checkout, the Webhook receives an authorization message from Facebook. Webhook makes a request to hybris for information about the order and sends it back to the user. See the example above, with the thank-you message in the chat. In my PoC, the order number is injected into the code, but for a real system, this value should be encrypted to avoid receiving information about someone else’s orders.

<div class="fb-send-to-messenger"
messenger_app_id="855289644608024"
page_id="1262635023749717"
data-ref="${orderNo}"
color="blue"
size="xlarge"></div>

This code displays the blue button.

Webhook knows about the recipientID, the unique ID of the user for this particular page. I link this ID with the userID when the customer enables messaging, so for the next messages, this ID will be used to specify the recipient of the message.

© Rauf Aliev, September 2016