Implement Webhooks Proposal #754
Replies: 2 comments
-
CLI looks like a perfectly sane interface to me, I'm impatient to try it already :) Let me have a shot at answering the questions from my point of view:
My question to you: do we need to have a |
Beta Was this translation helpful? Give feedback.
-
Update to say what actually got merged was not quite what is shown above. It's a top level |
Beta Was this translation helpful? Give feedback.
-
User Story
As a Prism CLI user, I am used to using Prism for improving the speed and accuracy of integrating with HTTP request/response APIs, but I would also love help integrating webhooks for my API.
Details
Prism is adding callbacks in #331, but there is another feature coming through the OpenAPI proposals pipeline called Webhooks conceived and championed by @lornajane in OAI/OpenAPI-Specification#1968.
The summary for callbacks vs webhooks is this: callbacks are events which are asynchronously responding to a request that happened. It's the observer pattern: you send a request, get. 201/202, then within some reasonable time-frame the callback URL is hit to confirm the thing was done, or failed, etc.
Webhooks are more about general events. You may subscribe to receive webhooks via a UI, then that URL will be blasted with any and all relevant events which happen until the end of time. As such these events are not related to paths in any way, they are a new top-level concept which use the same structure as callbacks, so a lot of the same code can be used.
Lorna wrote a blog post about webhooks and callbacks for more context.
Implementation
This will have nothing to do with the mock or proxy servers, as these events are sent by the server whenever events happen. They do not need a mock server running, we just need to emulate the triggering of these events, to hit the local developers code.
Using the nexmo SMS example:
TBD but maybe a command like this?
Questions
we have both webhook name
incoming-sms
and operationId ofincoming-sms
, is this redundant or will they sometimes be different? If so, for what reason?'{$request.body#/callback}': what is this and where is it coming from?
Beta Was this translation helpful? Give feedback.
All reactions