Huge news!Announcing our $20M Series A led by Andreessen Horowitz.Learn more
Log inDemoInstall

Package Overview
File Explorer

Package fbmsgr provides an API for interacting with Facebook Messenger. The first step is to create a new Messenger session. Do this as follows, replacing "USER" and "PASS" with your Facebook login credentials: Once you are done with a session you have allocated, you should call Close() on it to clear any resources (e.g. goroutines) that it is using. When sending a message, you specify a receiver by their FBID. The receiver may be another user, or it may be a group. For most methods related to message sending, there is one version of the method for a user and one for a group: To send or retract a typing notification, you might do: To send an attachment such as an image or a video, you can do the following: It is easy to receive events such as incoming messages using the ReadEvent method: With the EventStream API, you can get more fine-grained control over how you receive events. For example, you can read the next minute's worth of events like so: You can also create multiple EventStreams and read from different streams in different places. To list the threads (conversations) a user is in, you can use the Threads method to fetch a subset of threads at a time. For example, you can print out the IDs of every thread as follows:


Version published


fbmsgr GoDoc

This is a wrapper around Facebook Messenger's internal AJAX protocol. This wrapper could be used for any number of cool things, such as:

  • Tracking your friends' Messenger activity.
  • Analyzing your conversations (e.g. keywords analysis)
  • Automating "Away" messages
  • Creating chat bots

Current status

Currently, the API is fairly reliable and can perform a bunch of basic functionalities. Here is a list of supported features (it may lag slightly behind the master branch):

  • Send textual messages to people or groups
  • Send attachments to people or groups
  • Receive messages with or without attachments
  • Send read receipts
  • Receive events for incoming messages
  • Receive events for friend "Last Active" updates
  • Set chat text colors (to arbitrary RGB colors)
  • List a user's threads.
  • List messages in a thread.
  • Send and receive typing events
  • Delete messages


  • Support emojis in threads (i.e. the like button)
  • In FullActionLog, remove all duplicates, incase two messages have the same timestamp.
  • Emoji/sticker transmission
  • Modifying chat preferences (emoji, nicknames, etc.)
  • View pending message requests
  • Create new group chats


This is under a BSD 2-clause license. See LICENSE.


Last updated on 04 Apr 2018

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

SocketSocket SOC 2 Logo


  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc