Shopify Webhook Commander
Installation
$ npm i -g shopify-webhook-commander
Example
$ shopify-webhook-commander config:set
> Shop (with .myshopify.com): tbeseda.myshopify.com
> Password: ****************
$ shopify-webhook-commander webhook:create
> Webhook topic: ORDERS_CREATE
> Callback URL: https://ingest.my-app.com/
Created gid://shopify/WebhookSubscription/1021513859211 for "tbeseda"
$ shopify-webhook-commander webhook:list
Webhooks for "tbeseda"
Topic Endpoint ID
────────────── ────────────────────────── ───────────────────────────────────────────────
SHOP_UPDATE https://ingest.my-app.com/ gid://shopify/WebhookSubscription/1021513859211
$ shopify-webhook-commander webhook:delete
> Webhook id to delete: gid://shopify/WebhookSubscription/1021513859211
Deleted gid://shopify/WebhookSubscription/1021513859211 from "tbeseda"
Shopify Webhook Topics
This tool uses the Shopify Admin GraphQL API. Webhook subscription topics should be of type WebhookSubscriptionTopic
Note about auth tokens
This tool uses a single token to authenticate; this is easiest with a Shopify "Private" Admin App. Set the config secret to the private app password. There is no OAuth flow to help with "Custom" Partner apps.
In theory, you can instead provide an accessToken
acquired from a Custom app's authentication flow. I haven't tested this.
shopify-webhook-commander
doesn't really help for "Public" apps that typically manage webhooks for each shop install programatically.
Roadmap
- tests
😬 - replace Apollo client with a slimmer GQL lib
- integrate
@shopify/shopify-api
types -- gotta get rid of thoseany
types -
webhooks:update
command - autocomplete webhook topics
- auth loop for custom apps
oclif
Generated Docs:
The section below is auto-generated by oclif
upon package release.
shopify-webhook-commander
Set up Shopify webhook subscriptions from the command line
Usage
$ npm install -g shopify-webhook-commander
$ shopify-webhook-commander COMMAND
running command...
$ shopify-webhook-commander (-v|--version|version)
shopify-webhook-commander/0.2.1 darwin-arm64 node-v16.4.1
$ shopify-webhook-commander --help [COMMAND]
USAGE
$ shopify-webhook-commander COMMAND
...
Commands
shopify-webhook-commander config:reveal
shopify-webhook-commander config:set
shopify-webhook-commander config:unset
shopify-webhook-commander help [COMMAND]
shopify-webhook-commander webhooks:create
shopify-webhook-commander webhooks:delete
shopify-webhook-commander webhooks:list
shopify-webhook-commander config:reveal
print current Shopify config
USAGE
$ shopify-webhook-commander config:reveal
OPTIONS
-h, --help show CLI help
-y, --yes agree to reveal
See code: src/commands/config/reveal.ts
shopify-webhook-commander config:set
set Shopify credentials config
USAGE
$ shopify-webhook-commander config:set
OPTIONS
-h, --help show CLI help
--secret=secret
--shop=shop
See code: src/commands/config/set.ts
shopify-webhook-commander config:unset
remove Shopify config
USAGE
$ shopify-webhook-commander config:unset
OPTIONS
-h, --help show CLI help
See code: src/commands/config/unset.ts
shopify-webhook-commander help [COMMAND]
display help for shopify-webhook-commander
USAGE
$ shopify-webhook-commander help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
shopify-webhook-commander webhooks:create
create a webhook subscription
USAGE
$ shopify-webhook-commander webhooks:create
OPTIONS
-h, --help show CLI help
--callbackUrl=callbackUrl
--topic=topic
See code: src/commands/webhooks/create.ts
shopify-webhook-commander webhooks:delete
delete a webhook given a resource id
USAGE
$ shopify-webhook-commander webhooks:delete
OPTIONS
-h, --help show CLI help
--id=id
See code: src/commands/webhooks/delete.ts
shopify-webhook-commander webhooks:list
list existing shop webhook subscriptions
USAGE
$ shopify-webhook-commander webhooks:list
OPTIONS
-h, --help show CLI help
See code: src/commands/webhooks/list.ts