Nerixyz / instagram_mqtt

Realtime and Push Notification (FBNS) support for the instagram-private-api
MIT License
252 stars 50 forks source link

How to get Receiver Information on direct Messages #50

Closed jafferkazmi572 closed 4 years ago

jafferkazmi572 commented 4 years ago

Hey Everyone,

I am facing a problem while using multiple accounts is that when a new message receives i don't know which account belongs to this message. I have message data as follows

{ event: 'patch',
  message_type: 1,
  seq_id: 1035,
  mutation_token: '8217812-21121-1221-3133-1213314411',
  realtime: true,
  message:
   { path:
      '/direct_v2/threads/87218787218721721878721/items/7832878728737327972792397',
     op: 'add',
     thread_id: '87218787218721721878721',
     item_id: '7832878728737327972792397',
     user_id: 12345678910,
     timestamp: 1596013005121808,
     item_type: 'text',
     text: 'This is maessage',
     client_context: '76126-212121-1212-122112-21324214',
     show_forward_attribution: false,
     is_shh_mode: false } }

Thanks You @Nerixyz @TheNeKochan

jafferkazmi572 commented 4 years ago

Issue resolved by myself :)

I just passed username as argument to the the function that is called by realtime socket as follows

ig.realtime.on('message', logEvent('messageWrapper', username));