How to add TimeLine Comment to Customers using REST APIs?

I am looking to add comments using REST API on customer object, and I am able to add these comments from front-end easily requests are hitting https://admin.shopify.com/api/shopify/store-name?operation=TimelineCommentCreate&type=mutation with message and other variables but when I read the documentation it tells that mutation timelineCommentCreate doesn’t exist on the ‘Mutation’ type.

How can we achieve this?

4 Likes

Hi Abdul_Qayyum,

The timelineCommentCreate mutation is not available in Shopify’s public API. If you want to store extra data about a customer, one workaround could be to use Metafields. You can create a new metafield for a customer and store your comment there. You can use the metafieldCreate mutation in the GraphQL API, or you can use the /admin/api/#{api_version}/customers/#{customer_id}/metafields.json endpoint in the REST API to do this.

Hope this helps,

1 Like

Is there any way i can create the activity using REST API?
I just want to create a timeline activity programmatically in Shopify using REST API or something else if Comment APIs are not available!

4 Likes

same here, is it on the backlog to add this to the api rest or graphql? would be great if we can add events to the timeline for specific orders through the api

3 Likes

After two large archived threads, and multiple more requests, you would think this would become a priority. Is this going to be added any time soon?

We need to be able to log internal communication per order, and the time stamp helps. There are quite a few use cases for us. And for now it means I have to use my scripts to notify someone who then has to do it manually. Why is this not a thing? Shopify, let us COMMENT!

9 Likes

As an alternative to using the Metafield technique to add a comment, I thought I’d share another ‘hack’ to accomplish a timeline post.

I learned from another discussion on this topic (https://community.shopify.com/c/fulfillment-and-inventory/expose-the-timeline-through-an-api/m-p/762223) that if you add an order note, it adds that change to the timeline (including what was added). So…

  1. Get the current Order Note

  2. Change the Note to what you want to communicate in the Timeline

  3. Change the Note back to the original Order Note.

This does require expanding the timeline post to actually see the comment, but hey, this is a hack so what do you expect?!?! :rofl:

4 Likes