Skip to content

ConversationalComponents/py-fastapi-facebook-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-fastapi-facebook-webhook

Python 3.7+ License: MIT

Basic template for starting facebook chatbot app service, using FastAPI. FastAPI provides high performance and perfect tools for developing a small Async web server.

Requirements

  • Facebook App.
  • Facebook Page.
  • Google App Engine Service [Optional].

Deployment [Google App Engine]

Google App Engine is not must, can be deployed on Amazon and Azure too. however I attached an app.yaml file which make your life easier deploying the project on GAE.

Deploy The Service On GAE:

Setup Facebook App:

  • Generate access token for your page.
  • Set the PAGE_ACCESS_TOKEN value at the app.yaml file to be the access token that was generated at the step above.
  • Go to your Facebook App.
  • Sidebar -> Webhooks -> Edit Page Subscription.
    • At the callback URL field add your service url.
    • At the Verify Token field add the value that you set for VERIFY_TOKEN at the app.yaml file.

API DOC

Also Available on {service_uri}/docs.

Endpoint Method Description
/api/webhook GET Verifies the endpoint and returns the "hub.challenge" query parameter back as an echo on success.
POST Handling messages

Debug

  • Install ngrok.
  • Expose your local service running ngrok http 8000
  • Use the protected uri as a callback URL at your app configuration.

About

Basic template for starting facebook webhook service, using FastAPI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages