Facebook Messages access via imap

6k views Asked by At

Does anybody know if is possible to access facebook messages via imap or pop to manage facebook messages within an email client?

2

There are 2 answers

0
Igy On BEST ANSWER

No, this is not possible. Only the publicly documented APIs are available.

See especially the inbox connection of the User object

0
AudioBubble On

This Article propose a way to read and store facebook message:

The process is done through the following steps:

  • Logging in : Logging in might be one of the trickier parts. The way you login to an IMAP server is to use the following command:

    LOGIN username password

  • Listing folders : The command you’d issue to the IMAP server is:

    LIST "" *

Since we know from the Mailbox folder API description, there are only three folders. These folders are:

Inbox (folder_id 0)
Outbox (folder_id 1)
Updates (folder_id 4)

With this in mind, we can hard code the following response to the list command:

LIST (\HasChildren) "/" Inbox
LIST (\HasChildren) "/" Outbox
LIST (\HasChildren) "/" Updates
  • Selecting a folder : In IMAP, you use the following command to select a folder:

    SELECT folder-name

  • Getting message content: The key in getting messages trough IMAP is a command named FETCH. The FETCH command comes with a lot of different modes, but we’ll focus on the most fundamental ones. These are (AFAIK) FLAGS, RFC822, RFC822.HEADER, RFC822.TEXT, RFC822.SIZE and UID. Since RFC822 is just RFC822.HEADER and RFC822.TEXT combined, we have one less variable to worry about.

  • FETCH UID Let’s start with UID, as this is the easiest one. You’d issue this command as follows:

    FETCH 1:6 (UID)

The expected result would look something like this:

1 FETCH (UID 1029955483)
2 FETCH (UID 1029955484)
3 FETCH (UID 1029955485)
4 FETCH (UID 1029955486)
5 FETCH (UID 1029955487)
6 FETCH (UID 1029955488)

The equivalent command in Facebook’s API would be something like this (I’m not sure if it’s possible to combine queries like this, but you get the idea):

SELECT message_id FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0)

You would then use that output as the UID.

More operations are available in http://www.emailserviceguide.com/2010/01/making-facebooks-messaging-system-imap-compatible/