Schmavery / facebook-chat-api

Unofficial Facebook Chat API for Nodejs
MIT License
1.93k stars 596 forks source link

muteSettings, lastMessageID and other values not available in getThreadList #312

Open Unpaid8503 opened 8 years ago

Unpaid8503 commented 8 years ago

Hello, the documentation states that muteSettings, lastMessageID and some other items should be in the result of getThreadList, but I don't have them in my data.

Example thread data:

{"threadID":"1295979970427097","participants":["100000619620090","*******************","*******************"],"participantIDs":["100000619620090","*******************","*******************"],"formerParticipants":[],"name":"","snippet":"test","snippetHasAttachment":false,"snippetAttachments":[],"snippetSender":"100000619620090","unreadCount":1,"messageCount":1,"imageSrc":null,"timestamp":1471162936057,"serverTimestamp":1471162936057,"isCanonicalUser":false,"isCanonical":false,"isSubscribed":true,"folder":"inbox","isArchived":false,"recipientsLoadable":true,"hasEmailParticipant":false,"readOnly":false,"canReply":true,"composerEnabled":true}

I've tried both lastest npm release and git master versions.

Unpaid8503 commented 8 years ago

Looks like utils.js#L621 is supposed to be data.mute_settings, but the array is empty no matter what.

Schmavery commented 8 years ago

I don't really understand how it's possible you don't have a muteSettings or lastMessageID field on that object (even if it points to undefined), but it looks like you're right that we should have pointed that to data.mute_settings. Usually what happens in these situations is that facebook has changed the signature of their internal api, which breaks us. A good first step in investigation is to add a line printing out the value before we format it. In this case, you could try adding a console.log(data) here. It will let us know what facebook is sending us and let us know how to tweak the format function to accommodate the change.

Unpaid8503 commented 8 years ago

@Schmavery Here's one of the objects, the thread is actually muted for 24 hours.

{ thread_id: 'id.1061331337293140',
  thread_fbid: '1061331337293140',
  other_user_fbid: null,
  participants: 
   [ '**REDACTED**' ],
  former_participants: 
   [ **REDACTED** ],
  name: '**REDACTED**',
  snippet: 'and i dont wanna reset it again',
  snippet_has_attachment: false,
  snippet_attachments: [],
  snippet_sender: '**REDACTED**',
  unread_count: 26313,
  message_count: 118289,
  image_src: 'https://scontent-bru2-1.xx.fbcdn.net/v/t34.0-12/14055644_269080526807620_93867879_n.jpg?oh=411c2e8ac7651151c584e27241ae7bd8&oe=57B5E36E',
  timestamp_absolute: 'Today',
  timestamp_datetime: '8:58am',
  timestamp_relative: '8:58am',
  timestamp_time_passed: 0,
  timestamp: 1471417089716,
  server_timestamp: 1471417089716,
  mute_settings: [],
  is_canonical_user: false,
  is_canonical: false,
  is_subscribed: true,
  is_thread_queue_enabled: true,
  folder: 'inbox',
  is_archived: false,
  recipients_loadable: true,
  name_conversation_sheet_dismissed: false,
  has_email_participant: false,
  read_only: false,
  can_reply: true,
  composer_enabled: true,
  last_message_timestamp: 1471417089716,
  last_read_timestamp: 1470618476230,
  last_message_type: 'non_ad',
  ephemeral_ttl_mode: 0,
  custom_like_icon: null,
  titan_originated_thread_id: '<1465858262908:0-35338462d556cd5d@mail.projektitan.com>',
  custom_nickname: 
   { **REDACTED** },
  custom_color: '#636060',
  admin_ids: [],
  customization_enabled: true,
  approval_mode: 0,
  joinable_mode: { link: '', mode: 0 },
  approval_queue_ids: [],
  lightweight_events: null,
  timezone_warning_dismiss_count: {} }
Schmavery commented 8 years ago

Alright. It looks like they've stopped providing last_message_id, and there's not a whole lot we can do about the mute_settings being empty... Not sure what we can do here other than simply deprecating these fields from the api and documentation.

bsansouci commented 7 years ago

@ErmanSayin Hey! We just implemented a new function called getThreadInfoGraphQL. Could you try to see if you get the info you'd want from there? We'll probably use that thread info moving forward.