Basic template for starting facebook chatbot app service, using FastAPI. FastAPI provides high performance and perfect tools for developing a small Async web server.
- Facebook App.
- Facebook Page.
- Google App Engine Service [Optional].
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.
- SetUp gcloud console
- Go to the app.yaml directory.
- run
gcloud app deploy
- 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.
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 |
- Install ngrok.
- Expose your local service running
ngrok http 8000
- Use the protected uri as a callback URL at your app configuration.