Using the order timeline on the admin API

Shopify Partner
31 0 5

Hi, I saw a thread created ~2 years ago about being able to use the order timeline with the API and there was a reply saying that it was being looked into by a Shopify dev with hundreds of people upvoting the suggestion, but I haven't seen any communiction from Shopify since. Any word on if/when this will become availble, whether it's included in the Order object or it's own endpoint? Thanks.

0 Likes
Shopify Partner
282 1 26

+100 from me too about this!

Very much needed!

Excelify.io | Bulk Import Export Update Migrate | https://excelify.io
0 Likes
Shopify Partner
1838 173 569

Hi @adam and @maris

Not aware of Shopify having made these public, but the order object contains all event node objects if read access is sufficient for your needs. Yes, this is GraphQL Admin API only.

# simple query to get top 10 messages from order timeline
query {
  order(id: "gid://shopify/Order/INSERT_ORDER_ID_HERE") {
    events(first: 10) {
      edges {
        node {
          __typename message
        }
      }
    }
  }
}

And what follows is:

{
  "data": {
    "order": {
      "events": {
        "edges": [
          {
            "node": {
              "__typename": "BasicEvent",
              "message": "Karl Offenberger placed this order on test (checkout #5096489091187)."
            }
          },
          {
            "node": {
              "__typename": "BasicEvent",
              "message": "380,00 Kč was authorized on the Bogus ending in •• 1."
            }
          },
          {
            "node": {
              "__typename": "BasicEvent",
              "message": "Received new order <a href=\"https:\/\/bohothemes-test.myshopify.com\/admin\/orders\/879868051571\">#1003<\/a> by John Doe."
            }
          },
          {
            "node": {
              "__typename": "BasicEvent",
              "message": "Order confirmation email was sent to Karl Offenberger (email@hidden.no)."
            }
          },
          {
            "node": {
              "__typename": "BasicEvent",
              "message": "Karl Offenberger captured 380,00 Kč on the Bogus ending in •• 1."
            }
          },
          {
            "node": {
              "__typename": "BasicEvent",
              "message": "test refunded 380,00 Kč on the Bogus ending in •• 1."
            }
          },
          {
            "node": {
              "__typename": "BasicEvent",
              "message": "test sent an order cancelled email to Karl Offenberger (email@hidden.no)."
            }
          },
          {
            "node": {
              "__typename": "BasicEvent",
              "message": "test canceled this order. Reason: Other."
            }
          }
        ]
      }
    }
  }
}

As for posting custom events to timeline, you could look in to POST

https://MY_STORE_NAME.myshopify.com/admin/orders/INSERT_ORDER_ID_HERE/timeline_comments

Hope that helps find a workaround.

I turn coffee in to code - since 1998
0 Likes
Shopify Partner
282 1 26

Awesome, Karl Offenberger!

You saved the world!

Thank you!

Excelify.io | Bulk Import Export Update Migrate | https://excelify.io
0 Likes
Highlighted
Shopify Partner
1838 173 569

Glad to hear.

That's the beauty of GraphQL - no matter what the docs on the web say, the schema is entirely exploratory and self-documenting. Get a good client such as Insomnia and play around with all that Shopify's GraphQL APIs have to offer :) They did a great job IMO and I look forward to see what more will come.

I turn coffee in to code - since 1998
2 Likes
Shopify Partner
10 0 2

@Maris where you ever able to post a new entry to an orders timeline using QraphQL?

0 Likes
Shopify Partner
282 1 26

@bille wrote:

@Maris where you ever able to post a new entry to an orders timeline using QraphQL?


Hey, @bille !


Actually, no!

That's exactly what I was attempting once more just a couple of days ago... and didn't find any way to do it.

Reading is ok but creating - nope, not with GraphQL and not with REST API.

 

However, I vividly remember that back then, when I was looking into this some year ago, I was able to create it in some experiments, but don't remember anymore, how. And now, after trying everything, I have a feeling that I imagined it that I could create that comment. 🤔

 

I really hope Shopify will implement this someday soon as this is a quite highly needed feature.

Excelify.io | Bulk Import Export Update Migrate | https://excelify.io
0 Likes
Shopify Partner
10 0 2

Hi @Maris 

 

Thanks for sharing your experiences. You really got my hopes up with this comment

I was able to create it in some experiments, but don't remember anymore

But then you killed my hope for a greate weekend with

And now, after trying everything, I have a feeling that I imagined it that I could create that comment.

:-)

 

But I completely agree. I have not been successful either, and it would be a great improvement if Shopify decided to implement this.

1 Like
Shopify Partner
10 0 2

For anybody else reading this, then it's possible to find all events using the endpoints described here: https://help.shopify.com/en/api/reference/events/event#endpoints

 

But it's not possible to create a new event. The events type that is added by a customer manually entering something on the timeline is the commentevent: https://help.shopify.com/en/api/graphql-admin-api/reference/object/commentevent

 

@Maris have you tried creating a commentevent though GraphQL?

1 Like
Shopify Partner
282 1 26

@Maris have you tried creating a commentevent though GraphQL?


@bille - yep, tried, and tried "guessing" lots of undocumented ways which could potentially work, but they didn't.

Also, updating an existing event is not possible via API, and it looks like it's deliberately disallowed.

 

Excelify.io | Bulk Import Export Update Migrate | https://excelify.io
0 Likes