a facebook messenger hypermodern python library based on fastapi.
- Async
- based on
Pydantic
, easy to work withFastApi
- 1-1 structure to official facebook documentation
- Implement validation and Security Protocals
pip install songmam
WIP
There are a few examples under the folder, examples
from fastapi import FastAPI
from songmam import WebhookHandler, MessengerApi
from songmam.models.webhook import MessagesEvent
app = FastAPI(
title="echo"
)
handler = WebhookHandler(
app=app, path="/webhook", app_secret=FACEBOOK_APP_SECRET, verify_token=FACEBOOK_PAGE_VERIFY_TOKEN
)
api = MessengerApi(access_token=FACEBOOK_PAGE_ACCESS_TOKEN)
@handler.add(MessagesEvent)
async def handle_message(event: MessagesEvent, *args, **kwargs):
"""
echo back message
"""
await api.send(event.theMessaging.sender, event.theMessaging.message.text)
This project is used by the following companies:
- Codustry
If you have any feedback, you can create an issue or PR.
This project is licensed under the terms of the MIT
license. See LICENSE for more details.
This project was generated with python-package-template
.