Creating a GraphQL query for the Zapier integration
At times, you may want to send more information to Zapier (like the subheadine, body, and tag fields) than would otherwise be fetched from a standard request or webhook trigger (like the ID and other basic data). In this case, you can create a GraphQL query to supply Zapier with additional data. Once published, the query is available for use in a Zapier workflow (referred to as a zap) as a search event.
To create a GraphQL query for the Zapier integration:
- Click > Admin > Zapier.
- From the Create list, select GraphQL Query, then click New.
- Enter an internal name for this asset. Brightspot uses this name internally, such as in the search panel and recent activity widget. This name is not visible to visitors to your site.
- In the Description field, enter a description about what this query fetches.
- In the Zapier Label field, enter a value that will appear when creating actions in Zapier. Use something short, but descriptive of the what the query achieves (for example,
Find Article by ID
). - Under Endpoint, select the GraphQL API endpoint you added that you associated to the API client. For details, see Adding API endpoints for the Zapier integration.
- Under Query, enter the desired query. Brightspot recommends using the GraphQL explorer to more easily build the query from the schema. (To use the GraphQL explorer, you must have the developer permission
HTML Toggle
). See the example below for a simple query that returns articles by ID.query MyQuery($articleId: UUID) { Get { Record(with: {_id: $articleId}) { State { ... on Article { __typename headline { raw } subheadline { raw } body { raw } } _globals { Content__ObjectModification { scheduleDate } } } } } }
- Click Publish.
Once published, this query appears in Zapier as a search event for use in a zap.
Note
Once published, you may view analytics pertaining to this asset in the Analytics tab. The tab includes when it was last used, its success count, the number of its total requests, and the number of errors it has generated.
Previous Topic
Creating a GraphQL polling trigger for the Zapier integration
Next Topic
Creating a GraphQL mutation for the Zapier integration