Import Comment

Import Reddit posts or comments and generate AI replies (or use your own). Comments are created in Preview state and must be approved before posting.

Workflow

  1. Import - Use this endpoint to create comments in Preview state
  2. Review - Optionally edit the generated reply in the dashboard
  3. Approve - Use the Approve endpoint to publish

Endpoint

POST /api/products/{productId}/ai-comments/manual-import

Authentication

Requires API key authentication via Bearer token.

Authorization: Bearer sk_your_api_key

URL Parameters

ParameterTypeDescription
productIdstringYour product ID

Request Body

FieldTypeRequiredDescription
importsarrayYesArray of import objects (max 10)

Import Object

FieldTypeRequiredDescription
urlstringYesReddit post or comment URL
replystringNoYour custom reply text. If omitted, AI generates a reply
imageUrlstringNoImage URL to include with the reply
accountStrategystringConditionalRequired if the post is your own. Values: op or random

Reply Modes

  • AI Generated - Omit the reply field and AI will generate a contextual reply based on your product description
  • Manual Reply - Provide your own reply text to use as-is (no AI credit charged)

Account Strategy

When replying to your own posts (created via ReplyAgent), you must specify:

  • op - Reply using the original poster account
  • random - Reply using a random account from your pool

Example Requests

AI-Generated Reply

bash
curl -X POST https://www.replyagent.ai/api/products/prod_123/ai-comments/manual-import \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "imports": [
      {
        "url": "https://www.reddit.com/r/SaaS/comments/abc123/best_tools_for_startups/"
      }
    ]
  }'

Manual Reply

bash
curl -X POST https://www.replyagent.ai/api/products/prod_123/ai-comments/manual-import \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "imports": [
      {
        "url": "https://www.reddit.com/r/SaaS/comments/abc123/best_tools_for_startups/",
        "reply": "I have been using MyProduct for this exact use case. It handles X, Y, and Z really well."
      }
    ]
  }'

Batch Import

bash
curl -X POST https://www.replyagent.ai/api/products/prod_123/ai-comments/manual-import \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "imports": [
      {
        "url": "https://www.reddit.com/r/SaaS/comments/abc123/post1/"
      },
      {
        "url": "https://www.reddit.com/r/startups/comments/def456/post2/",
        "reply": "Custom reply for this one"
      }
    ]
  }'

Success Response

Status: 200 OK

json
{
  "success": true,
  "message": "Successfully imported 2 comment(s) (1 manual, 1 AI-generated)",
  "totalProcessed": 2,
  "totalErrors": 0,
  "manualReplyCount": 1,
  "aiGeneratedCount": 1,
  "results": [
    {
      "success": true,
      "commentId": "cm_abc123...",
      "url": "https://www.reddit.com/r/SaaS/comments/abc123/post1/",
      "subreddit": "SaaS",
      "aiGenerated": true,
      "commentLength": 245
    },
    {
      "success": true,
      "commentId": "cm_def456...",
      "url": "https://www.reddit.com/r/startups/comments/def456/post2/",
      "subreddit": "startups",
      "aiGenerated": false,
      "commentLength": 89
    }
  ]
}

Partial Success Response

When some imports succeed and others fail:

json
{
  "success": true,
  "message": "Successfully imported 1 comment(s) (0 manual, 1 AI-generated)",
  "totalProcessed": 1,
  "totalErrors": 1,
  "results": [
    {
      "success": true,
      "commentId": "cm_abc123...",
      "url": "https://www.reddit.com/r/SaaS/comments/abc123/post1/",
      "subreddit": "SaaS",
      "aiGenerated": true,
      "commentLength": 245
    }
  ],
  "errors": [
    {
      "url": "https://www.reddit.com/r/invalid/comments/xyz/",
      "error": "Failed to fetch Reddit data"
    }
  ]
}

Error Responses

400 Bad Request

json
{
  "error": "No imports provided. Please provide an array of { url, reply?, accountStrategy? }."
}
json
{
  "error": "Maximum 10 imports allowed per batch"
}
json
{
  "error": "Invalid Reddit URLs: https://invalid-url.com"
}

401 Unauthorized

json
{
  "error": "Unauthorized"
}

403 Forbidden

json
{
  "error": "Access denied to this product"
}

404 Not Found

json
{
  "error": "Product not found"
}

Credit Usage

  • AI-generated replies: 1 credit per import
  • Manual replies: No credit charged

Next Steps

After importing, comments are in Preview state. To publish them:

  1. Get the commentId from the response
  2. Call the Approve endpoint to schedule posting
bash
curl -X POST https://www.replyagent.ai/api/products/prod_123/ai-comments/cm_abc123.../approve \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"scheduleType": "immediate"}'