Skip to content

Add / Configure webhooks #14

@michaelwalkerfl

Description

@michaelwalkerfl

We need to add webhooks around each model event and also any other important API calls. Example:

package subscriber

import (
    "crowdstart.com/util/webhook"
)

// Hooks
func (s *Subscriber) AfterCreate() error {
    return webhook.Emit(s.Context(), s.Namespace(), "subscriber.created", s)
}

func (s *Subscriber) AfterUpdate(previous *Subscriber) error {
    return webhook.Emit(s.Context(), s.Namespace(), "subscriber.updated", s, prev)
}

func (s *Subscriber) AfterDelete() error {
    return webhook.Emit(s.Context(), s.Namespace(), "subscriber.deleted", s)
}

Models that need this:

  • bundle
  • collection
  • coupon
  • mailinglist
  • order
  • organization (only in default namespace)
  • payment
  • plan
  • product
  • referral
  • referrer
  • site
  • store
  • submission
  • subscriber
  • transaction
  • user (also in default namespace)
  • variant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions