Comments API & AI Auto Replies

Reply to social media comments automatically

Choose how you reply. Use our Comments API when your app writes the message. Use our AI-powered auto replies feature when you want Mallary to write and post a brand-aware response.

Replying to a social media comment through the Mallary API Jess asks a question under an Acme Labs post. An API request sends a reply that addresses her by name, and the reply appears beneath the post. acmelabs Just now Instagram Dark mode is finally here View all 2 comments Jess Does this work on iPad? API request POST /api/v1/comments/reply "message": "Yes, Jess! iPadOS 17+" acmelabs Yes, Jess! iPadOS 17+

Pick the comment tool that fits your work

Both choices help you reply faster. The key difference is who writes the message.

Choice 1 Your app writes it

Comments API

Get comments from your posts. Write the exact reply in your app, support tool, script, or AI agent. Then send it through one API.

  • You control every word
  • Good for custom apps and approval flows
See how the API works
Choice 2 Mallary writes it

AI Auto Replies

Add your business details once. Mallary finds useful questions, writes a reply that fits your brand, and posts it for you.

  • Replies without manual work
  • Uses your business details
  • Powered by ChatGPT
See how AI Auto Replies work
Comments API

Keep full control of every reply

Add social media comments to your product without building a new connection for each platform.

1

Get your comments

Use the numeric Mallary job/post ID for a post that has finished publishing. This is not the social platform post ID, URL, or batch ID.

2

Choose a comment

Read data.comments in the response. Choose a comment with can_reply set to true, then keep its id and post_id.

3

Write and send your reply

Your app, team, or AI agent writes the message. Send the comment's post_id, its id as comment_id, and your exact message. Mallary does not write this API reply.

Get the Mallary post ID from your posts list or the publishing response's jobs[].jobId. Use your API key on your server. The examples use 123 as a sample ID; replace it and COMMENT_ID_FROM_LIST with your own values.

For a grouped post, each comment has its own post_id. Use that ID when you reply. The reply body takes only post_id, comment_id, and message. Check the returned status before treating a reply as published.

Read the Comments API docs
GET: List comments
TerminalcURL
curl --fail-with-body --silent --show-error \
  --request GET 'https://mallary.ai/api/v1/posts/123/comments' \
  --header "Authorization: Bearer $MALLARY_API_KEY"
request.mjs / Node.js 18+JavaScript
const apiKey = process.env.MALLARY_API_KEY;
if (!apiKey) throw new Error('Set MALLARY_API_KEY on your server.');

const response = await fetch('https://mallary.ai/api/v1/posts/123/comments', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
  signal: AbortSignal.timeout(30_000),
});

if (!response.ok) {
  throw new Error(`Mallary request failed: HTTP ${response.status}`);
}

console.log(await response.json());
request.py / Python 3Python
import json
import os
from urllib.request import Request, urlopen

request = Request(
    'https://mallary.ai/api/v1/posts/123/comments',
    headers={'Authorization': f'Bearer {os.environ["MALLARY_API_KEY"]}'},
    method='GET',
)

# HTTP errors raise an exception instead of looking like a success.
with urlopen(request, timeout=30) as response:
    result = json.load(response)

print(json.dumps(result, indent=2))
request.php / PHP 8 + cURLPHP
<?php
$apiKey = getenv('MALLARY_API_KEY');
if (!$apiKey) throw new RuntimeException('Set MALLARY_API_KEY on your server.');

$request = curl_init('https://mallary.ai/api/v1/posts/123/comments');
curl_setopt_array($request, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
    CURLOPT_TIMEOUT => 30,
]);

$body = curl_exec($request);
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
$error = curl_error($request);
curl_close($request);

if ($body === false || $status >= 400) {
    throw new RuntimeException($error ?: "Mallary request failed: HTTP $status");
}

$result = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
POST: Send reply
TerminalcURL
curl --fail-with-body --silent --show-error \
  --request POST 'https://mallary.ai/api/v1/comments/reply' \
  --header "Authorization: Bearer $MALLARY_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "post_id": 123,
    "comment_id": "COMMENT_ID_FROM_LIST",
    "message": "Thanks for your question."
}'
request.mjs / Node.js 18+JavaScript
const apiKey = process.env.MALLARY_API_KEY;
if (!apiKey) throw new Error('Set MALLARY_API_KEY on your server.');

const response = await fetch('https://mallary.ai/api/v1/comments/reply', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "post_id": 123,
    "comment_id": "COMMENT_ID_FROM_LIST",
    "message": "Thanks for your question."
  }),
  signal: AbortSignal.timeout(30_000),
});

if (!response.ok) {
  throw new Error(`Mallary request failed: HTTP ${response.status}`);
}

console.log(await response.json());
request.py / Python 3Python
import json
import os
from urllib.request import Request, urlopen

payload = {
  "post_id": 123,
  "comment_id": "COMMENT_ID_FROM_LIST",
  "message": "Thanks for your question."
}

request = Request(
    'https://mallary.ai/api/v1/comments/reply',
    data=json.dumps(payload).encode('utf-8'),
    headers={
        'Authorization': f'Bearer {os.environ["MALLARY_API_KEY"]}',
        'Content-Type': 'application/json',
    },
    method='POST',
)

# HTTP errors raise an exception instead of looking like a success.
with urlopen(request, timeout=30) as response:
    result = json.load(response)

print(json.dumps(result, indent=2))
request.php / PHP 8 + cURLPHP
<?php
$apiKey = getenv('MALLARY_API_KEY');
if (!$apiKey) throw new RuntimeException('Set MALLARY_API_KEY on your server.');

$payload = [
  'post_id' => 123,
  'comment_id' => 'COMMENT_ID_FROM_LIST',
  'message' => 'Thanks for your question.'
];

$request = curl_init('https://mallary.ai/api/v1/comments/reply');
curl_setopt_array($request, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey, 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode($payload, JSON_THROW_ON_ERROR),
    CURLOPT_TIMEOUT => 30,
]);

$body = curl_exec($request);
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
$error = curl_error($request);
curl_close($request);

if ($body === false || $status >= 400) {
    throw new RuntimeException($error ?: "Mallary request failed: HTTP $status");
}

$result = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
Read reply fields and responses
AI Auto Replies

Answer useful questions while you are away

Mallary can watch new comments, find questions about your business, and post a helpful reply for you.

1

Add your business details

Tell Mallary about your services, features, prices, and common questions.

2

Turn on AI Auto Replies

Enable them for your account and choose whether to use them on each post.

3

Mallary replies for you

Mallary uses your details and the post to answer. It skips questions that are not about your business. Powered by OpenAI ChatGPT.

Learn how to enable AI Auto Replies
Instagram
Acme Co
Example social post receiving an AI-powered comment reply

sarah_designs Does this integrate with Slack? Need to know for my team!

Acme Co is typing . . .

Acme Co Hey Sarah! 👋 Yes, we have a native Slack integration available on all Pro plans. Let us know if you need help setting it up!

Reply to comments on seven social platforms

Use one comment workflow for posts you publish through Mallary.

Let Claude handle your social media comments

with a little help from the official Mallary Claude connector.

Comments FAQ

Common questions

Quick answers about the Comments API and AI Auto Replies.

What is the difference between the Comments API and AI Auto Replies?

With the Comments API, your app writes each reply and sends it through Mallary. With AI Auto Replies, Mallary writes and posts a reply using your saved business and post details.

Does the Comments API write my reply?

No. You, your app, or your AI agent writes the message. Mallary sends that message to the right social platform.

How do AI Auto Replies know what to say?

You add your business name, services, features, prices, and common questions in Mallary. AI Auto Replies use those details and the social post to write a useful answer. Unrelated questions are skipped.

Which social platforms support comment replies?

Mallary supports comment listing and replies for Facebook, Instagram, Threads, LinkedIn, X, YouTube, and Bluesky posts published through Mallary.

How much do the comment tools cost?

Read comments, send replies, and use AI auto-replies with your Mallary plan. X publishing and comments use credits at cost.

Comments API & AI Auto Replies

Choose your reply flow

Send your own replies with the Comments API, or let AI Auto Replies answer useful questions for you.

Read comments, send replies, and turn on AI auto-replies. Compare plans. Your 14-day trial requires a card.

With monthly billing, Starter is US$15, Pro is US$29, and Business is US$95 per month.

  • 14 day free trial
  • Cancel anytime
  • 30-day money-back guarantee