Creating a GraphQL mutation for the Zapier integration
You can create a GraphQL mutation that enables Zapier to modify Brightspot assets. For example, an editor working in a Google Doc can trigger the creation of an article in Brightspot. Once created, this mutation appears in Zapier as an action event for use in a zap.
To create a GraphQL mutation for the Zapier integration:
- Click > Admin > Zapier.
- From the Create list, select GraphQL Mutation, 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 mutation achieves, such as
Publishes new article in Brightspot
. - 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,
Publish New Article
). - 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 Mutation, enter the desired mutation. Brightspot recommends using the GraphQL explorer to more easily build the mutation from the schema. (To use the GraphQL explorer, you must have the developer permission
HTML Toggle
). See the example below for a simple mutation that publishes a new article.mutation MyMutation($headline: String = "", $body: String = "") { Save { Record( args: {diffs: {ArticleDiff: {headline: {html: $headline}, body: {html: $body}}}, urls: {generate: {}}} context: {dryRun: false, site: {_name: "Demo"}} ) { state { ... on Article { __typename _id } } } } }
- Click Publish.
Once published, this mutation appears in Zapier as an action 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 query for the Zapier integration
Next Topic
Creating a general Zapier search