Facebook-chat-api: Add support for "waving with hand"

Created on 17 Oct 2017  路  6Comments  路  Source: Schmavery/facebook-chat-api

Like in title

Most helpful comment

it is just sending message with attachment... so it wouldn't be hard to implement
POST data here:

client=mercury
action_type=ma-type:user-generated-message
ephemeral_ttl_mode=0
lightweight_action_attachment[lwa_state]=INITIATED
lightweight_action_attachment[lwa_type]=WAVE
message_id=6379352000000000000
offline_threading_id=6379352000000000000
other_user_fbid=100000000000000
source=source:messenger:web
specific_to_list[0]=fbid:100000000000000
specific_to_list[1]=fbid:111111111111111
timestamp=1520956131902

All 6 comments

It's already implemented in Browser-based Messenger? I saw this feature only on mobile-based messenger. It's required to have this feature in Browser-based Messenger

It is in web Messenger, when i will be back home, i will send screenshot

I can't see it in my web messenger, feel free reopen with more details or a PR :wink:

@Schmavery @gamelaster I could update this issue with an example request, will it be enough to implement it?

it is just sending message with attachment... so it wouldn't be hard to implement
POST data here:

client=mercury
action_type=ma-type:user-generated-message
ephemeral_ttl_mode=0
lightweight_action_attachment[lwa_state]=INITIATED
lightweight_action_attachment[lwa_type]=WAVE
message_id=6379352000000000000
offline_threading_id=6379352000000000000
other_user_fbid=100000000000000
source=source:messenger:web
specific_to_list[0]=fbid:100000000000000
specific_to_list[1]=fbid:111111111111111
timestamp=1520956131902

@ravkr do you remember what was the URL of the HTTP request? And if we need to add specific headers / cookies?
By the way, how can we find the values of message_id, offline_threading_id, specific_to_list[0] and specific_to_list[1]?
Facebook Messenger removed the wave feature this year but maybe it is just hidden and the API call still works.
I found a similar project with a wave feature so I will have a look: https://fbchat.readthedocs.io/en/stable/api.html#fbchat.Client.wave

Update: I got the wave feature working even if it is hidden from Facebook Messenger! I did not use a third-party app but directly the HTTP request. You can do it in a web browser like Firefox and open the developer tools (F12 shortcut). Then send a test message and you will see an HTTP request with the URL https://www.facebook.com/messaging/send/ in the Network tab of the developer tools. You can right click on it and select "Copy as cURL" or "Copy as Fetch". If you copy as Fetch, you can paste it in the Console tab of the developer tools and it uses the headers / cookies from your web browser. Then add the POST parameters &lightweight_action_attachment[lwa_state]=INITIATED&lightweight_action_attachment[lwa_type]=WAVE. You can replace INITIATED with RECIPROCATED if you want to reply to a wave, like mentioned in the documentation of the other project above.
The values message_id and offline_threading_id are the same, you can increase them manually from the previous requests or use the exact value with the JavaScript function generateOfflineThreadingID() from https://github.com/Schmavery/facebook-chat-api/blob/22b843def642eb4ab674db33a2628c8e16ce9dcf/utils.js#L124 (or the Python function generate_offline_threading_id() from https://github.com/fbchat-dev/fbchat/blob/916a14062d31f3624dfe8dd4ab672648a3e508c0/fbchat/_util.py#L58).
The value of specific_to_list[0] is the recipient ID, which is also used for the value of other_user_fbid. The value of specific_to_list[1] is your user ID.

Note: you can send a wave but the other user cannot reply using an official Messenger version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MikeShi42 picture MikeShi42  路  9Comments

rivc picture rivc  路  4Comments

DanH42 picture DanH42  路  3Comments

GEOFBOT picture GEOFBOT  路  4Comments

standnguyen197 picture standnguyen197  路  4Comments