Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to track multiple events in a single webhook #34

Closed
urkle opened this issue Mar 1, 2018 · 1 comment
Closed

Ability to track multiple events in a single webhook #34

urkle opened this issue Mar 1, 2018 · 1 comment

Comments

@urkle
Copy link

urkle commented Mar 1, 2018

Currently the webhooks are limited to 1 event only.. This is problematic and limiting. It overly complicates consumers and the payload itself does not provide enough context as to what the event is.. (relying on more complicated means to determining that).. Also it does not match the behavior of other webhooks implementations for other task tools.

My proposal is this.
Adjust the payload to this

{
    "action": "model.insert.Task",
    "model": {
        "id":109403,
       "name":"New Task",
       "project_id":59032,
       "tasklist_id":250019,
       "user_id":1093,
       "other_fields": "etc..."
    }
}

And then allow multiple events to be subscribed to by allowing a "events" parameter instead of "event" when creating the webhook. e.g.

{
   "target_url": "https://myapp.com/paymo/notifications/hashyURL",
   "events": [
       "model.insert.Task",
       "model.update.Task",
       "model.delete.Task",
       "model.insert.Tasklist",
       "model.update.Tasklist",
       "model.delete.Tasklist"
    ],
    "secret": "Asecrethash"
}

Then if "events" is used to create the webhook, it can be marked as a "version 2" webhook internally so you can easily know what structure to send the payload in. This will allow backward compatibility with old code as they will still be using "event" and thus not accidentally opt-in to the new payload structure. You could even return a "version" field in the payload list response for easier identification of what type of webhook it is.

@paymoapp
Copy link
Owner

paymoapp commented Mar 2, 2018

We've added wildcard events when creating webhooks. See: https://github.com/paymoapp/api/blob/master/sections/webhooks.md#wildcard and https://github.com/paymoapp/api/blob/master/sections/webhooks.md#headers

@paymoapp paymoapp closed this as completed Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants