-
Notifications
You must be signed in to change notification settings - Fork 358
Description
I am creating a messenger chatbot and I get the following error.
_> File "/app/app.py", line 87, in webhook
response = client.message(msg=text, context={'session_id':fb_id})
File "/app/.heroku/python/lib/python3.9/site-packages/wit/wit.py", line 69, in message
resp = req(self.logger, self.access_token, 'GET', '/message', params)File "/app/.heroku/python/lib/python3.9/site-packages/wit/wit.py", line 41, in req
raise WitError('Wit responded with status: ' + str(rsp.status_code) +
wit.wit.WitError: Wit responded with status: 400 (Bad Request)_
I know this is a client error and was raised before however I still cannot resolve it.
I am using Server Access Token to create my client.
Also this error is triggered as soon as I enter the webhook.
This is what my webhook looks like:
@app.route('/', methods=['POST'])
def webhook():
messaging_text = None
data = request.json
log(data)
if data['object'] == 'page':
for entry in data['entry']:
messages = entry['messaging']
if messages[0]:
message = messages[0]
fb_id = message['sender']['id']
text = message['message']['text']
response = client.message(msg=text, context={'session_id':fb_id})
handle_message(response=response, fb_id=fb_id)
Kindly help.