#Webhook Events

1 messages · Page 1 of 1 (latest)

lethal palm
#

Is there a way to integrate fastAPI or Flask to listen for events from a webhook inside the bot? If I am severely overthinking this, please let me know. My use case is for my business, where I use sellix.io to accept payments, and I need to listen for the order:created event from their webhook to dm a user when they pay.

atomic sealBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

muted moth
#

admittedly how is something i would have to research

#

ie (code not verified):

async def main():
    config = uvicorn.Config(app, port=8000)
    server = uvicorn.Server(config)
    
    # if you use python 3.11, a TaskGroup is better, but for 3.10...
    await asyncio.gather(server.serve(), bot.astart())
#

wait a sec we have a package lol

muted moth
#

yep

lethal palm
#

Im a biut confused how to use the @route decorator. Like how to get data from the route in my response

idle current
#

Should be the same as in fast api or flask

#

I should add some usage examples

lethal palm
#

I need to call the endpoint from my command right?

#

Is there a way to use this to run listen for a webhook event/payload and then execute code based on the received webhook event/payload? I can only see how to run the route when a command or event is executed