From 2f26180451c149ccd1fc2963e30820376d448a89 Mon Sep 17 00:00:00 2001 From: Sam Splunks <72095718+samsplunks@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:20:27 +0000 Subject: [PATCH] Update webhooks documentation with signals info --- docs/webhooks.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/webhooks.rst b/docs/webhooks.rst index 257dbe3f..19c56187 100644 --- a/docs/webhooks.rst +++ b/docs/webhooks.rst @@ -10,3 +10,29 @@ You can register webhooks to allow third party apps to be notified of helpdesk e 3. You can optionally set ``HELPDESK_WEBHOOK_TIMEOUT`` which defaults to 3 seconds. Warning, however, webhook requests are sent out sychronously on ticket update. If your webhook handling server is too slow, you should fix this rather than causing helpdesk freezes by messing with this variable. Once these URLs are configured, a serialized copy of the ticket object will be posted to each of these URLs each time a ticket is created or followed up on respectively. + + +Django signals +-------------- + +Webhooks are triggered through signals emitted for new tickets creation and ticket follow-up updates. + +The two existing signals are: + - new_ticket_done + - update_ticket_done + +You have the opportunity to listen to those in your project if you have post processing workflows outside of webhooks. + +``` +from helpdesk.signals import new_ticket_done, update_ticket_done + +@receiver(new_ticket_done) +def process_new_ticket(sender, ticket, **kwargs): + "Triggers this code when a ticket is created." + pass + +@receiver(update_ticket_done) +def process_followup_update(sender, followup, **kwargs): + "Triggers this code when a follow-up is created." + pass +``` \ No newline at end of file