Connect with us


Simplifying analytics for Messenger bots



For the busy developers or lazy readers: We have a new toy for you. Go and have fun! 🤝

It’s conventional wisdom that you can’t improve something that you can’t measure. Product usage data is not only interesting and nice to have, but an important foundation for making the right product decisions and assessing the effectiveness and ROI of your Messenger bot compared to other channels.

Example bot funnel for an e-commerce flow

For traditional websites, there is a myriad of tools and services available that web developers can use. This article outlines the best practice for using Facebook Analytics for Messenger bots and introduces an npm package which is aimed at helping developers to make integration effortless.

Experienced bot developers know that launching a conversational experience is only the start of the journey to improving your service over time — based on real user interactions. It’s a tough, but rewarding challenge because conversations are not deterministic by nature like graphical user interfaces. In other words, the bandwidth of user actions is much wider than on traditional websites where the user can scroll, click pre-defined buttons, and write text in known input fields or text areas.

On the Messenger platform, the most integrated way to log bot activity is to use Facebook Analytics (FBA) in form of custom app events through the app activities endpoint. Although logging an event to FBA only requires a simple API call, many bot developers skip this step and launch Messenger experiences without having a measurement framework in place.

The Partner Engineering team at Facebook has therefore set out to simplify event logging for Messenger bots. The result is a thin integration layer that sits between your Messenger bot and Facebook Analytics.

Meet the messenger-analytics package

The messenger-analytics package offers a simple interface to Facebook Analytics (FBA) for Messenger bots. It provides a thin integration layer as well as a collection of commonly used bot events to give you a basic idea of useful metrics.

Facebook Analytics (FBA) is a people-first analytics tool for an omni-channel world. It can be used as a standalone logging solution for your Messenger bot or in addition to other analytics software. FBA is closely integrated with the Facebook ecosystem, including Ads Manager and the Facebook Pixel. This allows you to optimize your campaigns for specific actions in the bot and to combine pixel data from your website with Messenger bot activity.

A question that Facebook Analytics can answer: “How many people purchased an item on my website after having been consulted by the bot beforehand?”

The Facebook Messenger platform automatically logs certain events for your bot, for example “message sent” and “message received”. These events are logged on the app-level and can be visualized in Facebook Analytics (FBA).

In addition to these automatic events, FBA also supports the logging of custom events which enable you to visualize user journeys and track the performance metrics of your choice. The messenger-analytics package helps you to log custom events in Facebook Analytics.


npm install --save messenger-analytics


const FBA = require("messenger-analytics");

Creating an event logger

Create a logger using the app and page ID associated with your bot.

const logger = new FBA.Logger({

Logging events

The simplest form of logging an event is to provide an event name and the user identifier (PSID). You can either use an event name defined in this module or choose an arbitrary name.

Note: Whenever possible and applicable, use the so called predefined app events in FBA.EventNames.Predefined. They are utilized across the Facebook ecosystem and are needed for campaign attribution and optimization in Ads Manager. Given the significance of these events for other Facebook products and services, it is advisable to treat them as first choice.

// Using a predefined event name (required if you want to report on a specific metric in Ads Manager)
).then(() => {
console.log("Event successfully logged to FBA.");
}).catch((err) => {
});// Using a custom event name
).then(() => {
console.log("Event successfully logged to FBA.");
}).catch((err) => {

You may also attach parameters to an event. These parameters can be used for filtering, segmentation, and campaign reporting. Predefined events have specific parameter definitions which need to be followed if you want to log purchases and see the purchase value and currency in Ads Manager, as an example. The parameter definitions can be found in the App Events API event structure.

On top of these standard parameters, you may also log additional custom parameters. Parameters for custom events don’t have to follow any naming convention.

// Purchase event with 3 standard 1 custom parameters
_valueToSum: 87.90, // standard parameter, defaults to 1
fb_num_items: 3, // standard parameter
fb_currency: "EUR", // standard parameter
custom_var: "hello_world", // custom parameter
).then(() => {
console.log("Event successfully logged to FBA.");
}).catch((err) => {

These parameters can then be used in FBA to filter your results:

Filtering events by parameters

Platform and language availability

We chose to publish this analytics package for bots built on NodeJS (written in JavaScript) first. Depending on popularity and demand, we might follow up with implementations for other popular “bot builder languages” like PHP, C#, Ruby, or Python. If you have a preference, let us know in the comments! 🙂 In the meantime, you can simply send your requests straight to FBA using our the analytics quick start guide.

Facebook Analytics for Messenger is MIT licensed.

Messenger Developer Blog


Best Practices for Designing Great Messaging Experiences on Messenger



We recently reminded our community of the upcoming policy changes to the Messenger platform that will go into effect on March 4, 2020. These policy changes were designed to improve the messaging experience between people and businesses by driving timely and personally relevant conversations — prioritizing conversations started by people and related follow-up communications.

To help businesses best adapt to these new policy changes, here are some tips on the best practices to adopt when designing messenger experiences:

1. Respond quickly and set customer expectations on response times

People expect businesses to respond quickly and provide timely updates. We have found a strong correlation between responsiveness and successful business outcomes.>

2. Make it short and sweet

Make sure to communicate your key points succinctly and early on in your message. This aligns with people’s expectations for messaging as a channel and increases readability. Messages that are short and to the point can also be read clearly in message previews.

3. Leverage Messenger features to send high value messages outside the 24 hour standard messaging window

Successful businesses know the options available to send messages outside the standard messaging window and use them effectively.

  • Message tags – use tags to send personal, timely and important non-promotional messages. Businesses can use tags to send account updates, post purchase updates, confirmed event updates, and human agent responses.
  • One-Time Notification – allows a page to request a user to send one follow-up message after the 24-hour messaging window has ended. This can be used for cases such as back in stock alerts where a person has explicitly requested the business to send out a notification. Make sure that the message matches the topic the user agreed to receive the notification for and this message is fully communicated on the first attempt. You may also want to prompt people to interact with your notification in order to restart the standard messaging window.
  • Sponsored Messages – use sponsored messages for broadcast promotional updates to customers you’ve interacted with in Messenger. Sponsored messages support Facebook ads targeting and have built-in integrity controls to help us safeguard the user experience in Messenger.

4. Focus on customer value

Ensure your messages clearly communicate customer value – especially notifications sent outside the standard messaging window. Sending out low value messages makes it more likely that customers will tune out or block messages from your business altogether. Businesses using Messenger’s platform should consider adjusting push parameters for valuable messages that don’t require immediate action.

5. Provide audiences with options to choose from

Consider giving your audience additional control over the type of content they will receive via Messenger. For example, you may allow the user to select specific types of account alerts or post-purchase updates provided they comply with the Messenger platform policies.

We believe following these simple guidelines will help to ensure a businesses’ messaging efforts will be effective and drive outcomes, while providing customers with pleasant and valuable interaction experiences that encourage them to continue engaging with the business on Messenger.

Facebook Developers

Continue Reading


Two Billion Users — Connecting the World Privately



We are excited to share that, as of today, WhatsApp supports more than 2 billion users around the world.

Mothers and fathers can reach their loved ones no matter where they are. Brothers and sisters can share moments that matter. Coworkers can collaborate, and businesses can grow by easily connecting with their customers.

Private conversations that once were only possible face-to-face can now take place across great distances through instant chats and video calling. There are so many significant and special moments that take place over WhatsApp and we are humbled and honored to reach this milestone.

We know that the more we connect, the more we have to protect. As we conduct more of our lives online, protecting our conversations is more important than ever.

That is why every private message sent using WhatsApp is secured with end-to-end encryption by default. Strong encryption acts like an unbreakable digital lock that keeps the information you send over WhatsApp secure, helping protect you from hackers and criminals. Messages are only kept on your phone, and no one in between can read your messages or listen to your calls, not even us. Your private conversations stay between you.

Strong encryption is a necessity in modern life. We will not compromise on security because that would make people less safe. For even more protection, we work with top security experts, employ industry leading technology to stop misuse as well as provide controls and ways to report issues — without sacrificing privacy.

WhatsApp started with the goal of creating a service that is simple, reliable and private for people to use. Today we remain as committed as when we started, to help connect the world privately and to protect the personal communication of 2 billion users all over the world.

The post Two Billion Users — Connecting the World Privately appeared first on About Facebook.

Facebook Newsroom

Continue Reading


Facebook, Instagram and YouTube: Government forcing companies to protect you online



Although many of the details have still to be confirmed, it’s likely the new rules will apply to Facebook, Twitter, Whatsapp, Snapchat, and Instagram

We often talk about the risks you might find online and whether social media companies need to do more to make sure you don’t come across inappropriate content.

Well, now media regulator Ofcom is getting new powers, to make sure companies protect both adults and children from harmful content online.

The media regulator makes sure everyone in media, including the BBC, is keeping to the rules.

Harmful content refers to things like violence, terrorism, cyber-bullying and child abuse.

The new rules will likely apply to Facebook – who also own Instagram and WhatsApp – Snapchat, Twitter, YouTube and TikTok, and will include things like comments, forums and video-sharing.

Platforms will need to ensure that illegal content is removed quickly, and may also have to “minimise the risks” of it appearing at all.

These plans have been talked about for a while now.

The idea of new rules to tackle ‘online harms’ was originally set out by the Department for Digital, Culture, Media and Sport in May 2018.

The government has now decided to give Ofcom these new powers following research called the ‘Online Harms consultation’, carried out in the UK in 2019.

Plans allowing Ofcom to take control of social media were first spoken of in August last year.

The government will officially announce these new powers for Ofcom on Wednesday 12 February.

But we won’t know right away exactly what new rules will be introduced, or what will happen to tech or social media companies who break the new rules.

Children’s charity the NSPCC has welcomed the news. It says trusting companies to keep children safe online has failed.

“Too many times social media companies have said: ‘We don’t like the idea of children being abused on our sites, we’ll do something, leave it to us,'” said chief executive Peter Wanless.

“Thirteen self-regulatory attempts to keep children safe online have failed.

To enjoy the CBBC Newsround website at its best you will need to have JavaScript turned on.

Back in Feb 2018 YouTube said they were “very sorry” after Newsround found several videos not suitable for children on the YouTube Kids app

The UK government’s Digital Secretary, Baroness Nicky Morgan said: “There are many platforms who ideally would not have wanted regulation, but I think that’s changing.”

“I think they understand now that actually regulation is coming.”

In many countries, social media platforms are allowed to regulate themselves, as long as they stick to local laws on illegal material.

But some, including Germany and Australia, have introduced strict rules to force social media platforms do more to protect users online.

In Australia, social media companies have to pay big fines and bosses can even be sent to prison if they break the rules.

For more information and tips about staying safe online, go to BBC Own It, and find out how to make the internet a better place for all of us.

Read More

Continue Reading