Skip to content
A boilerplate for Shopify webhook consumption and processing.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
cmd
internal
pkg
.env.sample
.gitignore
LICENSE
README.md
example.gif
go.mod
go.sum

README.md

SWF

No tests yet...

A boilerplate for Shopify webhook consumption and processing.

Provides a HTTP server which verifies all webhooks to an API secret, and passes the webhook to a handler function.

Provides a worker server which listens for jobs and acts on them.

Ability to interchange loggers, workers (Redis, SQS, etc), and more through the available interfaces.

Usage

Note: See current internal directory for examples.

  1. Create a .env file (see .env.sample for example)
  2. Create tasks in internal/app/task which have a consumer and perform function
  3. Modify internal/app/config.go to configuration values for your app
  4. Modify internal/app/app.go to adjust your envrironment and register webhooks and tasks
  5. See build and run below

Build

$ bin/build

Will produce two binaries, build/swf_worker and build/swf_server.

Run

$ ./build/swf_worker and $ ./build/swf_server

Using base internal example, you can pass the following cURL command to get a result:

curl -X POST http://localhost:1234/webhook/orders_create -H "X-Shopify-Shop-Domain: example.myshopify.com" -H "X-Shopify-Hmac-Sha256: 7iASoA8WSbw19M/h+lgrLr2ly/LvgnE9bcLsk9gflvs=" -H "Content-Type: application/json" --data '{"key":"value"}'

Example

Example

You can’t perform that action at this time.