0
votes

Am trying to implement facebook messenger chatbot in python. Am created One API in python below

@api_view(['GET'])
def verify(request):
    form_data = request.query_params
    mode = form_data.get('hub.mode')
    token = form_data.get('hub.verify_token')
    challenge = form_data.get('hub.challenge')
    if mode and token:
        if mode == 'subscribe' and token == "mytestingtoken":
            print("WEBHOOK_VERIFIED")
            return JsonResponse({"code":200,'message':challenge})
        else:
            return JsonResponse({"code":403})
    return JsonResponse({"code":200,'message':'test'})

am mapping the API URL into ngrok URL(https://55d71a8248be.ngrok.io)

then am created a Facebook App and configured a webhook. here callback URL and Verify Token also setup. but finally I got Error Message

The Callback URL or Verify Token couldn't be validated. Please verify the provided information or try again later.enter image description here

Am referred facebook document https://developers.facebook.com/docs/messenger-platform/getting-started/webhook-setup

1
I'm all the sudden getting this error. Did you fix it? - Alex Lacayo

1 Answers

0
votes

Use HttpResponse for API Response return HttpResponse("message",200)