1
GraphQL support for actions
Max Musing
Note that it's currently possible to run GraphQL mutations as actions using standard HTTPS requests. Check out this Apollo blog post for details: https://www.apollographql.com/blog/graphql/basics/making-graphql-requests-using-http-methods/
Alfred Nøland
Max Musing: Hi, it`s not possible to pass variables or make mutation requests. Would be great to see support for GraphQL query and mutations.
Robert Cooper
Hi Alfred Nøland: thanks for asking about this. We do have GraphQL support on our roadmap. But for now, I claim there is a functional workaround.
Prior to launching Actions, I did a bit of experimenting with a GraphQL endpoint (Linear, which we use for issue tracking) and was able to successfully setup a test action which executes a mutation. I got it going with a POST request and by putting the query inside the plain-text body of the HTTP request.
Here's the plain-text body I used:
{
"query":"mutation IssueCreate { issueCreate( input: { title: \"{{ issueName }}\" description: \"{{ description }}\" teamId: \"1234abcd-this-is-a-pretend-team-id\" }) { success issue { id title } } }"
}
Note my use of
{{ issueName }}
and {{ description }}
in there. They are being interpolated with values from two User inputs I defined on the action. I also attach a screenshot.So essentially, my approach sidesteps GraphQL variables as it just interpolates the dynamic user-provided values directly into the GraphQL query in the plain-text body.
My takeaway from this experiment has been: It's not too pretty but it
can
be done to shove a GraphQL query into a plain HTTP request.P.S. Here's that body as a GitHub gist, in case this Canny text field clobbers it: https://gist.github.com/jeremysarchet/d84e0160b8dd3883f449809fe8450bd4
P.P.S Here's a blog post which inspired me to try this in the first place a while back: https://www.maxivanov.io/make-graphql-requests-with-curl/

Jeremy Sarchet
Hi Alfred Nøland: thanks for asking about this. We do have GraphQL support on our roadmap. But for now, I claim there is a functional workaround.
Prior to launching Actions, I did a bit of experimenting with a GraphQL endpoint (Linear, which we use for issue tracking) and was able to successfully setup a test action which executes a mutation. I got it going with a POST request and by putting the query inside the plain-text body of the HTTP request.
Here's the plain-text body I used:
{
"query":"mutation IssueCreate { issueCreate( input: { title: \"{{ issueName }}\" description: \"{{ description }}\" teamId: \"1234abcd-this-is-a-pretend-team-id\" }) { success issue { id title } } }"
}
Note my use of
{{ issueName }}
and {{ description }}
in there. They are being interpolated with values from two User inputs I defined on the action. I also attach a screenshot.So essentially, my approach sidesteps GraphQL variables as it just interpolates the dynamic user-provided values directly into the GraphQL query in the plain-text body.
My takeaway from this experiment has been: It's not too pretty but it
can
be done to shove a GraphQL query into a plain HTTP request.P.S. Here's that body as a GitHub gist, in case this Canny text field clobbers it: https://gist.github.com/jeremysarchet/d84e0160b8dd3883f449809fe8450bd4
P.P.S Here's a blog post which inspired me to try this in the first place a while back: https://www.maxivanov.io/make-graphql-requests-with-curl/
