muhammed nishad
muhammed nishad

Reputation: 35

Facebook Messengerbot python ( The Callback URL or Verify Token couldn't be validated. Please verify the provided information or try again later.)

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

Upvotes: 0

Views: 2446

Answers (2)

logbasex
logbasex

Reputation: 2312

Maybe you'll need setup auth token for ngrok.

enter image description here

Upvotes: 0

muhammed nishad
muhammed nishad

Reputation: 35

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

Upvotes: 1

Related Questions