Hi everyone,
I’m trying to get a shipping label of an order by using GraphQL.
Meanwhile the solution I got so far is to access all the events of the order and then in the code filtering if the message contains a string “purchased a shipping label”.
Here is an example of a query send and a response I get:
query:
{
order(id: "gid://shopify/Order/123456789") {
events(first: 5) {
edges {
node {
message
}
}
}
}
}
response:
{
"data": {
"order": {
"events": {
"edges": [
{
"node": {
"message": "This order was archived."
}
},
{
"node": {
"message": "Shipping confirmation email was sent to Josh."
}
},
{
"node": {
"message": "Shopify fulfilled 2 items from 630 route 217."
}
},
{
"node": {
"message": "Josh purchased a shipping label for $13.99."
}
},
{
"node": {
"message": "Order edited email was sent to Josh."
}
}
]
}
}
}
}
but I’m only interested in the specific message
"node": {
"message": "Josh purchased a shipping label for $13.99."
}
Is there a way in GraphQL to filtering the string already in the query so I can get only this message?
Thanks for the helpers,
Tom