Skip to main content
Testing your actions using GraphQL

Quick article that shows you how you can test your actions using GraphQL instead of doing it via the front end of your application.

Updated over 2 weeks ago

Sometimes the actions that you build require a bit of finetuning before they do exactly what you want them to do. You can test them using a variety of ways, like making proper use of the log step to pinpoint where your action breaks, read more about that here. Or maybe you prefer to use the playground and use GraphQL, if so, continue reading.

Working in the playground

You might want to use GraphQL to test your actions. Especially when you use custom action steps or when you make use of sub-actions and similar steps. You can find the playground by pressing the Test run button in your action.

A pop will appear with some information.

First, you'll have to go to the playground by pressing the Go to playground button. A new tab will open where you can see the GraphQL playground.

The next step is to copy the mutation part of the pop-up in the previous tab. If you run it now you'll likely receive an error depending on your action's configurations.

If your action requires input variables, define those in the 'query variable' tab in the bottom-left. You can copy the variable part of the pop-up in the previous tab, make sure to configure it though.

Now if your action is private you'll also need a valid Bearer token, which you can define in the Headers tab. Check out this article for more information on retrieving your Bearer token.

Regardless, you can test your actions here without the need of using the front end of your application. If you have for example a form that creates new users you can simply specify their name and other credentials and hit run to first of all test if your action works and second not use the front end for it.

Working with the playground and using GraphQL is recommended when you're building custom action steps. You can quickly check if the functionality of the custom step that you're writing is working as intended.

Whilst working in the playground we recommend that you use the following browser extension: GraphQL Netherwork Inspector. This makes it easier to check what's happening behind the curtains, after installing the extension you can find it in the developer tools of your browser.

Did this answer your question?