paxswill / evesrp

EVE Ship Replacement Program (SRP) webapp
BSD 2-Clause "Simplified" License
18 stars 14 forks source link

Add webhooks #88

Open paxswill opened 8 years ago

paxswill commented 8 years ago

Add webhooks for various events, like on request submission, when actions are performed, etc. The goal for this is to make life easier for external clients and to make extending built-in functionality easier. A couple of use cases:

paxswill commented 8 years ago

Related to the last use case, I have a silly dream where an external program gets activated from a web hook, evaluates a fit against one specified using Pyfa's fitting engine to determine what kind of payout is correct, then sets that on the request.

paxswill commented 8 years ago

Events that it should be possible to register webhooks on:

Hooks should be able to be specified at either a division level (configurable by division admins) or on an site level (configurable by site admins). I'm going to pattern the API after GitHub's Webhooks, with the caveat that authenticated requests will be added later.

For user login events, this will (if implemented at all) only be able to be configured on a site-wide basis by the site admins. Even then, I'm not sure if I'll be able to make it performant enough to be viable.

paxswill commented 8 years ago

Authenticated HTTP requests (from the app) to a registered webhook should also be able to respond to some events. Some examples:

I'm thinking of having these be authenticated with the same secret key (see the GitHub docs) used to authenticate the requests from the app. The other option is to maybe use asymmetric keys to handle that (with maybe auto-generated app-side keys?). Again, will need to think about this to get it right.

BlueNexus commented 8 years ago

Once webhooks are added, I should be able to develop something to automatically calculate the base payout of a request.

paxswill commented 8 years ago

OK, so I hashed out a start to what I think the API will look like for this.