Closed trgwii closed 8 years ago
Hey @trgwii, thanks for reporting this! Can you add console.log(m)
after this line and paste here just the result of that when you receive a message from that chat?
Here you go:
Tried to make formal steps to reproduce this below..
Steps to reproduce (hopefully):
None of the messages sent by users in the group will have the threadID property set.
This may also have something to do with the group creator's privacy settings...
Here is the result of console.log(m)
with a failing message:
{ message:
{ subject: null,
body: '.',
timestamp: 1457099724965,
mid: 'mid.1457099724959:8bc2f7c00b37648160',
tid: 'mid.1456918504911:ab64e4ba52',
sender_fbid: 1640610814,
offline_threading_id: '6111519205172308761',
sender: '1640610814@facebook.com',
sender_name: null,
tags: 'source:messenger:web,tq,cg-enabled,inbox',
source: 'source:unknown',
attachmentIds: null,
forward: 0,
replyActionType: 0,
action_id: '1457099725004000000',
prev_last_visible_action_id: '1457099642795000000',
mercury_author_id: 'fbid:1640610814',
mercury_author_email: '1640610814@facebook.com',
is_spoof_warning: false,
mercury_source: 'source:messenger:web',
mercury_source_tags: [],
mercury_coordinates: null,
html_body: '',
short_source: 1,
is_unread: true,
has_attachment: false,
attachments: [],
attachment_map: {},
share_map: null,
ranges: [],
threading_id: '<1457099725049:0-a6db3e7e42e2d40e@mail.projektitan.com>',
api_tags: [ 'inbox', 'source:web' ],
ephemeral_ttl_mode: 0,
timestamp_absolute: 'Today',
timestamp_datetime: '2:55pm',
timestamp_relative: '2:55pm',
timestamp_time_passed: 0,
group_thread_info:
{ participant_ids: [Object],
participant_names: [Object],
participant_total_count: 4,
name: 'Ringeriksveien 38',
pic_hash: '' },
should_buzz: false,
is_silent: false,
other_user_fbid: null,
thread_fbid: '992053190863527' },
event: 'deliver',
html: '',
msg_body: '',
is_unread: true,
folder: 'inbox',
thread_row: '',
unread_counts:
{ other: 0,
montage: 0,
hidden: 0,
pending: 0,
spam: 0,
sent: 1,
inbox: 2 },
new_participants: '',
sequence_id: 326,
realtime_viewer_fbid: 100008322246360,
type: 'messaging' }
Thanks a lot for following up with such detailed information.
Here is the relevant line, looks like they've changed the format of the tid
field to start with 'mid' instead of 'id'. Should be fairly simple to fix, just change the line to the following to remove the dependency on the prefix. Can you make this change locally and check if it fixes it? Feel free to submit a PR if it does.
threadID: originalMessage.tid ? originalMessage.tid.split('.')[1] : originalMessage.other_user_fbid,
@trgwii Can you sync to master and try this fix?
Well, i think the thread_info no more send a thread informations, so only way to get participiants is to fetch it when thread_sync or unread_threads is executed. Then maybe in "roger" informations is a users information, but... hmm. When I rewriting this to .NET library (unfinished), I cached all informations (so i not must everytime to execute thread_info for info about people etc..), and similiar a web Messenger works, so I think this is needed for good working.
I don't understand, this change has nothing to do with participants...
I was having a similar problem but I updated my utils.js with this edit https://github.com/Schmavery/facebook-chat-api/commit/192e635979fe71ee18dfbf6683beb52b70f3f8ae and now it works as expected.
Thanks for confirming @avikj
Pushed this fix to npm.
Title really says it all, if I receive a message from a group, the threadID-property is null.
Edit: It seems that this only happens if a non-friend of the api user has created the group, and the bot is added to the group later.
Using facebook-chat-api version 1.0.7