Skip to content

Commit

Permalink
Webhooks guide (#237)
Browse files Browse the repository at this point in the history
* Add note on endpoint to webhook example

* Add note on endpoint to webhook example go
  • Loading branch information
gvdongen authored Jan 22, 2025
1 parent ffb6eea commit dae93e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion go/patterns-use-cases/src/webhookcallbacks/callbackrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import restate "github.com/restatedev/sdk-go"
type WebhookCallbackRouter struct{}

// Any handler can be a durable webhook processor that never loses events
// You don't need to do anything special for this. Just point your webhook to the handler endpoint.
// You don't need to do anything special for this.
// Just point your webhook to the handler endpoint: restate:8080/WebhookCallbackRouter/OnStripeEvent

func (WebhookCallbackRouter) OnStripeEvent(ctx restate.Context, event StripeEvent) error {
if event.Type == "invoice.payment_failed" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const webhookCallbackRouter = restate.service({
name : "WebhookCallbackRouter",
handlers: {
// Any handler can be a durable webhook processor that never loses events
// You don't need to do anything special for this. Just point your webhook to the handler endpoint.
// You don't need to do anything special for this.
// Just point your webhook to the handler endpoint: restate:8080/WebhookCallbackRouter/onStripeEvent
onStripeEvent: async (ctx: restate.Context, event: StripeEvent) => {
if (event.type === "invoice.payment_failed") {
ctx.objectSendClient(PaymentTracker, event.data.object.id)
Expand Down

0 comments on commit dae93e6

Please sign in to comment.