Handle Webhooks with GraphQL Subscriptions
GraphQL Mesh v0 documentation (superseded by v1): Handle Webhooks with GraphQL Subscriptions in your unified schema using GraphQL Mesh. Use PubSub implementation to bind webhook paths to specific topics and consume them as subscription root fields. You can also generate GraphQL type definitions from sample JSON responses using the JSON Schema Handler.
GraphQL Mesh can consume Webhooks as GraphQL Subscriptions in the unified schema by using the built-in PubSub implementation
Add a new Subscription field
You can use additionalTypeDefs and resolveTo directive to add subscription root fields to your
unified schema.
If you subscribe a pubSub topic with webhook:EXPECTED_METHOD:EXPECTED_PATH, the server will
automatically bind that path to that topic.
We can use existing types from our unified schema, and this root field is subscribed to our specific
topic in our PubSub service.
Use JSON Schema Handler instead
You can also use the JSON Schema handler if you don’t want to write an extra GraphQL type definition. You can generate GraphQL type definitions from sample JSON response;
Just add the following to your existing JSON schema handler configuration in .meshrc.yml file;