Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot cant send message #10

Closed
nggary opened this issue Oct 21, 2017 · 2 comments
Closed

Bot cant send message #10

nggary opened this issue Oct 21, 2017 · 2 comments

Comments

@nggary
Copy link

nggary commented Oct 21, 2017

I have modify the receive message part, so it can send message after message is received:

def fb_receive_message():
message_entries = json.loads(request.data.decode('utf8'))['entry']
for entry in message_entries:
for message in entry['messaging']:
if message.get('message'):
print("{sender[id]} says {message[text]}".format(**message))
client = Messager("Access code of page")
recipient_id = message['recipient']['id']
client.send_text(recipient_id, "Hello, I'm enginebai.")
return "Hi"

The access token is generated according to the tutorial image: https://cdn-images-1.medium.com/max/1600/1*op5S9F_-vsBv7FLrd4mv1g.png

In message.py line 219 req show http 400 error

@nggary
Copy link
Author

nggary commented Oct 22, 2017

I figure it out myself:
Change recipient_id = message['recipient']['id'] to
recipient_id = message['sender']['id']

In message.py, URL_BASE = "https://graph.facebook.com/v2.9/me/"
make sure all the post_url is not 404

@nggary nggary closed this as completed Oct 22, 2017
@nggary nggary reopened this Oct 22, 2017
@nggary
Copy link
Author

nggary commented Oct 22, 2017

I reopen this because I think the author may want to modify the sender example and message.py

@nggary nggary closed this as completed Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant