Encrypted chats

Learn how end-to-end encrypted Messenger chats behave with Unipile API.

Personal 1:1 and group chats on Facebook are end-to-end encrypted. Conversations with a Page are not. Unipile handles the difference for you: you call the same methods with the same chat IDs, for both types of chats.

The difference that matters to your integration is access to past messages.


Access to past messages

New messages are always received and sent, with or without any further setup. Past messages are stored in Messenger's encrypted backup, which can only be read with a secret held by the user: the recovery code, or the Messenger PIN.

The user provides this secret through the ENCRYPTED_HISTORY step when linking the account. Hosted Authentication displays this step automatically.

MethodHistory unlockedHistory not unlocked
List all Chat Messages, Get a MessagePast messages are availableOnly the messages received since the account was linked are available
Get a Message AttachmentPast files are availableFiles of past messages return provider/method_not_allowed
📘

What Unipile stores

Only the recovery code is stored, with the account's other authorization data. A PIN is exchanged once for the recovery code, then discarded. The stored code survives reconnections.


Differences to expect

  • Reactions: the message.reaction.delete event is only sent for encrypted chats.
  • Attachments: when several files are sent at once, each one becomes a separate message.
  • Forwarding: a message with attachments or without text can't be forwarded from an unencrypted chat to an encrypted one.

Did this page help you?