You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started playing around with this library over christmas and were having problems getting it to work while the node version Facebook provided worked flawless.
Error
I was getting error messages along the lines of
'{"object":"page","entry":[{"id":"xxxxxxxxxxxxxxxxxx","time":1514482715763,"messaging":[{"sender":{"id":"xxxxxxxxxxxxxxxxxx"},"recipient":{"id":"xxxxxxxxxxxxxxxxxx"},"timestamp":1514482714981,"message":{"mid":"mid.$cAAEiNjh2mVNmz3mRZVgnjRIp5XRk","seq":xxxxxx,"sticker_id":369239263222822,"attachments":[{"type":"image","payload":{"url":"https:\\/\\/scontent-atl3-1.xx.fbcdn.net\\/v\\/t39.1997-6\\/851557_369239266556155_759568595_n.png?_nc_ad=z-m&_nc_cid=0&oh=3692392632228223692392632&oe=759568595","sticker_id":369239263222822}}]}}]}]}'
Received message for user xxxxxxxxxxxxxxxxxx and page xxxxxxxxxxxxxxxxxx at 1514482714981 with message:
{'mid': 'mid.$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'seq': xxxxxxxxxxxxxxxxxx, 'sticker_id': 369239263222822, 'attachments': [{'type': 'image', 'payload': {'url': 'https://scontent-atl3-1.xx.fbcdn.net/v/t39.1997-6/851557_369239266556155_759568595_n.png?_nc_ad=z-m&_nc_cid=0&oh=3692392632228223692392632&oe=759568595', 'sticker_id': 369239263222822}}]}
{"error":{"message":"(#230) Requires pages_messaging_phone_number permission to manage the object","type":"OAuthException","code":230,"fbtrace_id":"xxxxxxxxxxxxxxxxxx"}}
AFTER_SEND : {"message": {"attachment": null, "metadata": null, "quick_replies": null, "text": "Message with attachment received"}, "notification_type": null, "recipient": {"id": "xxxxxxxxxxxxxxxxxx", "phone_number": null}, "sender_action": null}
RESPONSE : {"error":{"message":"(#230) Requires pages_messaging_phone_number permission to manage the object","type":"OAuthException","code":230,"fbtrace_id":"xxxxxxxxxxxxxxxxxx"}}
Now that was quite verbose but I cleaning it up a bit I could clearly see the problem as: Requires pages_messaging_phone_number permission to manage the object combined with "recipient": {…, "phone_number": null}, something which isn't used in the reference implementation provided by Facebook.
Solution
The trivial solution were to just comment out line 31 and voila the bot worked as expected, if it's used I could add a conditional.
Is the phone_number field ever used?
And if so is there any reason to send it when it's null?
Adding a conditional check or simply removing it from the Recipient class would both simplify development when working building a bot from scratch but would also remove unnecessary permission dependencies.
If there's no particular reason to send null when it isn't send I'd be happy to send a pull-request with a fix.
The text was updated successfully, but these errors were encountered:
Background
I started playing around with this library over christmas and were having problems getting it to work while the node version Facebook provided worked flawless.
Error
I was getting error messages along the lines of
Now that was quite verbose but I cleaning it up a bit I could clearly see the problem as:
Requires pages_messaging_phone_number permission to manage the object
combined with"recipient": {…, "phone_number": null}
, something which isn't used in the reference implementation provided by Facebook.Solution
The trivial solution were to just comment out line 31 and voila the bot worked as expected, if it's used I could add a conditional.
fbmq/fbmq/payload.py
Line 31 in d53505f
Conlusion
Is the phone_number field ever used?
And if so is there any reason to send it when it's null?
Adding a conditional check or simply removing it from the Recipient class would both simplify development when working building a bot from scratch but would also remove unnecessary permission dependencies.
If there's no particular reason to send null when it isn't send I'd be happy to send a pull-request with a fix.
The text was updated successfully, but these errors were encountered: