Skip to content

Create Comment ​

POSThttps://api.repliz.com/public/content/{contentId}/comment

Post a comment on a specific piece of content, optionally with an image. The comment is published directly to the platform and includes an ID, message, author, and timestamp.

Endpoint Details ​

  • Authentication: Basic Auth (Authorization: Basic Base64(AccessKey:SecretKey))
  • Access Tier: Gold+

Parameters ​

ParameterTypeRequiredDescription
contentIdstringYesID of the post on the platform, the id from Get Content, for example 113958387982006_942538351814577 on Facebook.

Request Body ​

FieldTypeRequiredDescription
accountIdstringYesID of the connected account the post belongs to, the _id from Get Account. The comment is posted as this account.
textstringYesText of the comment. Required, even when an image is attached.
commentIdstringNoID of a comment on the platform to reply to, the id from Get Comment. Leave it out to comment on the post itself.
imageobjectNoAn image posted together with text. See Image Object.

Image Object ​

The same format as the Image Object of Send Message.

FieldTypeRequiredDescription
urlstringYesPublic URL of the image file. The platform downloads the image from it.
mimetypestringYesMIME type of the image, like image/jpeg or image/png.
thumbnailstringNoSmaller preview shown in Repliz. It isn't sent to the platform.
PlatformImageNotes
Facebook✅
Threads✅
TikTok✅JPG, PNG, or WebP, up to 5 MB, 360×360 up to 1080×1920 or 1920×1080 pixels.
LinkedIn✅
X (Twitter)✅Uses 1 X (Twitter) credit per comment, the same as a text comment.
Instagram❌The image is ignored and only text is posted.
YouTube❌The image is ignored and only text is posted.

The image is sent by URL

The url must be public and point straight at the file. You can host the image in Repliz Storage, see the Storage Upload guide.

json
{
  "accountId": "680affa5ce12f2f72916f67e",
  "text": "Thank you for your comment!",
  "image": {
    "url": "https://storage.repliz.com/uploads/repliz-thank-you.png",
    "thumbnail": "https://storage.repliz.com/uploads/repliz-thank-you-thumbnail.png",
    "mimetype": "image/png"
  }
}

Example Request ​

bash
curl -X POST "https://api.repliz.com/public/content/113958387982006_942538351814577/comment" \
  -H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "680affa5ce12f2f72916f67e",
    "text": "This is a comment"
  }'
javascript
import axios from 'axios';

const contentId = '113958387982006_942538351814577';

const response = await axios.post(
  `https://api.repliz.com/public/content/${contentId}/comment`,
  {
    accountId: '680affa5ce12f2f72916f67e',
    text: 'This is a comment',
  },
  {
    auth: {
      username: 'YOUR_ACCESS_KEY',
      password: 'YOUR_SECRET_KEY',
    },
  },
);

console.log(response.data);
javascript
const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');

const contentId = '113958387982006_942538351814577';

const response = await fetch(`https://api.repliz.com/public/content/${contentId}/comment`, {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    accountId: '680affa5ce12f2f72916f67e',
    text: 'This is a comment',
  }),
});

const data = await response.json();
console.log(data);

Response ​

json
{
  "commentId": "942538351814577_1677536300098026"
}
json
// Account Not Found
{
  "code": 404,
  "message": "account not found"
}

// Comment Not Found
{
  "code": 404,
  "message": "comment not found"
}
json
{
  "code": 401,
  "message": "unauthorized"
}