exp:expgraphqlwebhooks
The webhooks of the GraphQL API: list them, add or change one (with a new signing secret), remove one, send a test, deliver now, read the delivery log; a dry run unless --apply.
Script bin/php/expgraphqlwebhooks.php, code in kernel/private/classes/commands/expgraphqlwebhooks.php. Run it from the installation root, as the user the web server runs as:
./console exp:expgraphqlwebhooks --help
./console exp:graphql:webhooks --help
php bin/php/expgraphqlwebhooks.php --helpHelp text
The webhooks of the GraphQL API
Every event of the GraphQL event journal an end point asks for (publish, update, trash, delete, move,
hide, reveal, mutation) is POSTed to it as JSON, signed with HMAC-SHA-256 (X-Exponential-Signature,
X-Exponential-Timestamp), by the cronjob part graphqlwebhooks, with retries. The end points are
settings (graphql.ini [GraphQLWebhooks] EndpointList[] and a block [GraphQLWebhook_<name>] each,
written to settings/override); the signing secret is kept in the secret store (Setup > Secrets)
and shown once, when --add makes it. Nothing is written or sent without --apply.
./console exp:graphql:webhooks the list
./console exp:graphql:webhooks --add=shop --url=https://shop.example.com/hooks/exponential \
--events=publish,update,trash --classes=article --siteaccess=eng --apply
./console exp:graphql:webhooks --add=search --url=https://search.example.com/hook --payload=query \
--query=article_for_index --as=indexer --apply
./console exp:graphql:webhooks --test=shop --apply send a test event now
./console exp:graphql:webhooks --deliver --apply what the cronjob part does, now
./console exp:graphql:webhooks --log --limit=50
./console exp:graphql:webhooks --remove=shop --apply
Exit code: 0 done (or shown); 1 a file could not be written, a secret not stored, or the test was
not answered with 2xx; 2 wrong options (an unknown webhook, a URL or an event that is not one).Options
| Option | Value | Help |
|---|---|---|
--list | list the webhooks (the default) | |
--add | required | add the webhook of this name, or change it (lower case letters, digits and _) |
--remove | required | remove the webhook of this name (and its signing secret) |
--test | required | send a test event (ping) to the webhook of this name |
--deliver | read the journal and send the deliveries that are due, as the cronjob part does | |
--log | the last lines of the delivery log | |
--url | required | the end point (--add): http:// or https:// |
--events | required | the events it wants (--add), comma separated: publish, update, trash, delete, move, hide, reveal, mutation; none: every event |
--siteaccess | required | only content of these siteaccesses (their root node and languages), comma separated |
--classes | required | only these class identifiers, comma separated |
--subtree | required | only content at or below these node ids, comma separated |
--payload | required | event (the default): the event and its ids; query: the answer of a persisted query |
--query | required | the name or SHA-256 of the persisted query (--payload=query) |
--as | required | the user the persisted query runs as (a login; default: anonymous) |
--secret-name | required | the name of the signing secret in the secret store, or env:VARIABLE (default graphql.webhook.<name>) |
--limit | required | lines of the delivery log (--log; default 20) |
--format | required | text (the default) or json (the list, --log) |
--apply | write and send; without it nothing is changed |
Read from the option definitions in the code (startup(), getOptions(), options() or ezcConsoleOption). Every script also takes the standard options of the script framework (--help, --siteaccess, --debug, --quiet, --allow-root-user ...).
Related
Generated by ./console exp:help:examples from bin/php/expgraphqlwebhooks.php, kernel/private/classes/commands/expgraphqlwebhooks.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.