Is it possible to create prefect webhook notificat...
# ask-community
s
Is it possible to create prefect webhook notification with json data populated by flow run url? Is there a predefined variable we could use?
w
hey @schwannden kuo, there is a simple way to do this on cloud - and a slightly more complicated way to do this in open source. which are you on? In any case im down to hop on an pair on this if you’re interested.
s
I am currently in open source
pair programming would be a bit harder for the moment (too many meetings recently, hard to have a timeslot now), thank you for the help! Is it possible to provide a guide? I'll work on it on my free time, and I am pretty comfortable tracing source code too, so a outline would probably hepl me a lot, thank you!
w
hey no problem. re-reading, I’m not sure there is a variable you can set server side that would resolve to a flow run’s url, however, I do think that you can construct that URL from within flow code and then ping that out somehow. would that work? Id start by checking out the prefect client, and methods like the following which construct and return key app urls. https://docs.prefect.io/2.14.9/api-ref/prefect/client/orchestration/#prefect.client.orchestration.PrefectClient.api_url There also might be useful information returned by get_context https://docs.prefect.io/2.14.9/api-ref/prefect/context/?h=context#prefect.context.get_run_context
s
I see, if I am programmatically calling the webhook in prefect flow, I am able to get flow run url indeed. But the use case is to allow people to come up here and register their own webhook. Wish to open this as a self-serviced notification service. Thx for answering, I am guessing with webhook there is no way to send webwook with flow run url currently. I will get everything from header to see if some header field is avaiilable for the task, thx!
👍 1