Re: How to add TimeLine Comment to Customers using REST APIs?

How to add TimeLine Comment to Customers using REST APIs?

Abdul_Qayyum
Shopify Partner
9 0 6

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?

Replies 5 (5)

Liam
Shopify Staff
2807 310 805

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,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Abdul_Qayyum
Shopify Partner
9 0 6

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!

Abdul_Qayyum_0-1698135371487.png

 

 

Thomas_Lang1
Shopify Partner
235 6 55

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

 

Software Developer | Owner of Tom IT - We build shopify apps
Marketplace Order Connector | Amazon bol.com & Walmart DSV
Order Related Documents | Print documents, Email document &Autoprint
Blog Product Spotlight | Add products to your blog articles!

mikaockerman
Shopify Partner
2 0 6

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!

Paul_Adams
Tourist
7 1 7

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/762...) 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.  

Paul_Adams_0-1714512009230.png

 

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