Added example with return to the webhook handler.

This commit is contained in:
Fabio Manganiello 2024-05-25 22:05:09 +02:00
parent baee33b88f
commit 7c7e488867
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -704,7 +704,6 @@ from platypush.events.http.hook import WebhookEvent
hook_token = "abcdefabcdef" hook_token = "abcdefabcdef"
# Expose the hook under the /hook/at_home endpoint # Expose the hook under the /hook/at_home endpoint
@when(WebhookEvent, hook="at_home") @when(WebhookEvent, hook="at_home")
def at_home_webhook(event: WebhookEvent): def at_home_webhook(event: WebhookEvent):
@ -717,6 +716,9 @@ def at_home_webhook(event: WebhookEvent):
return return
run('procedure.at_home') run('procedure.at_home')
# Return anything back to the client
return {'status': 'ok'}
``` ```
Then you can invoke your custom logic over HTTP: Then you can invoke your custom logic over HTTP: