Skip to the content
Documentation

exp:expgraphqlwebhooks

No ratings yet

Available since Exponential 6.0.15 (in development, not in a release yet).

Summary

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

Usage

./console exp:expgraphqlwebhooks [options]
php bin/php/expgraphqlwebhooks.php [options]
./console exp:graphql:webhooks [options]

Aliases

exp:graphql:webhooks

Help

The output of ./console help exp:expgraphqlwebhooks (the script run with --help), without the standard options:

Usage: bin/php/expgraphqlwebhooks.php [OPTION]...
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:
  --list               list the webhooks (the default)
  --add=VALUE          add the webhook of this name, or change it (lower case letters, digits and _)
  --remove=VALUE       remove the webhook of this name (and its signing secret)
  --test=VALUE         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=VALUE          the end point (--add): http:// or https://
  --events=VALUE       the events it wants (--add), comma separated: publish, update, trash, delete, move, hide, reveal, mutation; none: every event
  --classes=VALUE      only these class identifiers, comma separated
  --subtree=VALUE      only content at or below these node ids, comma separated
  --payload=VALUE      event (the default): the event and its ids; query: the answer of a persisted query
  --query=VALUE        the name or SHA-256 of the persisted query (--payload=query)
  --as=VALUE           the user the persisted query runs as (a login; default: anonymous)
  --secret-name=VALUE  the name of the signing secret in the secret store, or env:VARIABLE (default graphql.webhook.<name>)
  --limit=VALUE        lines of the delivery log (--log; default 20)
  --format=VALUE       text (the default) or json (the list, --log)
  --apply              write and send; without it nothing is changed

Options

Option Value Description
--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

Standard options

Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.

Source

bin/php/expgraphqlwebhooks.php, kernel/private/classes/commands/expgraphqlwebhooks.php

See also

Generated example: exp:expgraphqlwebhooks

Added to the reference for Exponential 6.0.15.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.