--- title: commentNotSpam - GraphQL Admin description: >- Reverses a spam classification on a comment, restoring it to normal moderation status. This mutation allows merchants to change their decision when a comment has been manually marked as spam. For example, when a merchant reviews comments marked as spam and finds a legitimate customer question, they can use this mutation to restore the comment's normal status and make it eligible for approval. Use the `commentNotSpam` mutation to: - Unmark comments that were marked as spam - Restore comments to normal moderation status - Move comments back to the approval queue This action changes the comment's status from spam back to pending, where it can then be approved or managed according to standard moderation practices. api_version: unstable api_name: admin source_url: html: 'https://shopify.dev/docs/api/admin-graphql/unstable/mutations/commentNotSpam' md: >- https://shopify.dev/docs/api/admin-graphql/unstable/mutations/commentNotSpam.md --- # comment​Not​Spam mutation Requires Any of `write_content`, `write_online_store_pages` access scopes. Reverses a spam classification on a comment, restoring it to normal moderation status. This mutation allows merchants to change their decision when a comment has been manually marked as spam. For example, when a merchant reviews comments marked as spam and finds a legitimate customer question, they can use this mutation to restore the comment's normal status and make it eligible for approval. Use the `commentNotSpam` mutation to: * Unmark comments that were marked as spam * Restore comments to normal moderation status * Move comments back to the approval queue This action changes the comment's status from spam back to pending, where it can then be approved or managed according to standard moderation practices. ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/ID) required The ID of the comment to be marked as not spam. *** ## Comment​Not​Spam​Payload returns * comment [Comment](https://shopify.dev/docs/api/admin-graphql/unstable/objects/Comment) The comment that was marked as not spam. * user​Errors [\[Comment​Not​Spam​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/unstable/objects/CommentNotSpamUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Mark a comment as not spam #### Description Marks an existing spam comment as not spam. #### Query ```graphql mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } } ``` #### Variables ```json { "id": "gid://shopify/Comment/9450891" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } }", "variables": { "id": "gid://shopify/Comment/9450891" } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } }`, { variables: { "id": "gid://shopify/Comment/9450891" }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } } QUERY variables = { "id": "gid://shopify/Comment/9450891" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } }`, "variables": { "id": "gid://shopify/Comment/9450891" }, }, }); ``` #### Response ```json { "commentNotSpam": { "comment": { "id": "gid://shopify/Comment/9450891" }, "userErrors": [] } } ``` * ### Marks a comment as not spam #### Query ```graphql mutation CommentNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { code field message } } } ``` #### Variables ```json { "id": "gid://shopify/Comment/9450891" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation CommentNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { code field message } } }", "variables": { "id": "gid://shopify/Comment/9450891" } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation CommentNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { code field message } } }`, { variables: { "id": "gid://shopify/Comment/9450891" }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation CommentNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { code field message } } } QUERY variables = { "id": "gid://shopify/Comment/9450891" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation CommentNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { code field message } } }`, "variables": { "id": "gid://shopify/Comment/9450891" }, }, }); ``` #### Response ```json { "commentNotSpam": { "comment": { "id": "gid://shopify/Comment/9450891" }, "userErrors": [] } } ``` * ### commentNotSpam reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20MarkCommentAsNotSpam\(%24id%3A%20ID!\)%20%7B%0A%20%20commentNotSpam\(id%3A%20%24id\)%20%7B%0A%20%20%20%20comment%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%7D%0A%20%20%20%20userErrors%20%7B%0A%20%20%20%20%20%20field%0A%20%20%20%20%20%20message%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22id%22%3A%20%22gid%3A%2F%2Fshopify%2FComment%2F9450891%22%0A%7D) ##### GQL ```graphql mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } } ``` ##### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } }", "variables": { "id": "gid://shopify/Comment/9450891" } }' ``` ##### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } }`, { variables: { "id": "gid://shopify/Comment/9450891" }, }, ); const json = await response.json(); return json.data; } ``` ##### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } }`, "variables": { "id": "gid://shopify/Comment/9450891" }, }, }); ``` ##### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation MarkCommentAsNotSpam($id: ID!) { commentNotSpam(id: $id) { comment { id } userErrors { field message } } } QUERY variables = { "id": "gid://shopify/Comment/9450891" } response = client.query(query: query, variables: variables) ``` ## Input variables JSON ```json { "id": "gid://shopify/Comment/9450891" } ``` ## Response JSON ```json { "commentNotSpam": { "comment": { "id": "gid://shopify/Comment/9450891" }, "userErrors": [] } } ```