Discussing APIs and development related to customers, discounts, and order management.
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?
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
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!
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
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!
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.
This does require expanding the timeline post to actually see the comment, but hey, this is a hack so what do you expect?!?! 🤣