This Azure Function project implements a Facebook Messenger bot that automatically sends cute cat photos to users who message your Facebook page. The bot uses Azure HTTP-triggered functions to handle Meta webhooks and respond with adorable cat images.
- Users send messages to your Facebook page via Messenger
- Facebook sends webhook events to your Azure Function endpoint
- The function processes the incoming message
- Bot responds automatically with a cute cat photo utilizing free cat api https://developers.thecatapi.com/
- HTTP Trigger Function: The azure function receives POST requests from Facebook's webhook system
- Webhook Verification: Validates incoming requests using Facebook's verification token
- Message Processing: Parses incoming message events and user data
- Cat Photo API Integration: Fetches random cat images from external API
- Messenger Send API: Sends cat photos back to users via Facebook's Graph API
- Azure subscription with Function App deployed
- Facebook Developer Account
- Facebook Page for the bot
- Create Facebook App: Visit Facebook Developers and create a new app
- Configure Webhooks: Follow the official Facebook Graph API Webhooks Documentation
- Set Webhook URL: Point to your Azure Function HTTP endpoint
- Configure Page Access Token: Generate token for your Facebook page
- Subscribe to Events: Enable
messagesandmessaging_postbacksevents
-
Deploy Function: Deploy this project to your Azure Function App
-
Environment Variables: Configure the following app settings:
META_PAT: Page access token from FacebookMETA_APP_SECRET: Your webhook verification token (the secret)
-
HTTP Endpoint: Note your function's HTTP trigger URL for webhook configuration