> ## Documentation Index
> Fetch the complete documentation index at: https://developers.trynawa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reply to Comment

> Generate a context-aware reply to a comment in Arabic or English.

Generate an AI-powered reply that matches the commenter's language and cultural context. For Arabic comments, replies match the detected dialect (Gulf, Egyptian, Levantine, MSA). For English comments, replies are natural and platform-appropriate. Language is auto-detected unless overridden.

<Note>
  Cost: **\$0.008** per request (8 credits). Semantic cache hits are free (`X-NAWA-Cache: HIT`).
</Note>

## Request

### Path parameters

| Parameter | Type   | Required | Description                 |
| --------- | ------ | -------- | --------------------------- |
| `id`      | string | Yes      | The comment ID to reply to. |

### Body parameters

| Parameter    | Type    | Required | Description                                                                               |
| ------------ | ------- | -------- | ----------------------------------------------------------------------------------------- |
| `tone`       | string  | No       | Reply tone: `friendly`, `professional`, `casual`, `formal`. Default: `friendly`.          |
| `max_length` | integer | No       | Maximum reply length in characters. Default: 500.                                         |
| `context`    | string  | No       | Additional context about the channel or video to improve reply relevance.                 |
| `language`   | string  | No       | Force reply language: `ar`, `en`, `auto`. Default: `auto` (matches commenter's language). |

### Example request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.trynawa.com/v1/comments/cmt_abc123/reply \
    -H "Authorization: Bearer nawa_test_sk_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "tone": "friendly",
      "context": "Tech review channel focused on smartphones"
    }'
  ```

  ```typescript TypeScript theme={null}
  const { data, error } = await nawa.comments.reply('cmt_abc123', {
    tone: 'friendly',
    context: 'Tech review channel focused on smartphones'
  })
  ```

  ```python Python theme={null}
  result = nawa.comments.reply(
      comment_id="cmt_abc123",
      tone="friendly",
      context="Tech review channel focused on smartphones"
  )
  ```
</CodeGroup>

## Response

### Success response (200)

```json theme={null}
{
  "success": true,
  "result": {
    "comment_id": "cmt_abc123",
    "reply_text": "إن شاء الله الجزء الثاني قريب! تابعنا عشان ما يفوتك 🔔",
    "reply_dialect": "gulf",
    "tone": "friendly",
    "original_intent": "question",
    "original_dialect": "gulf"
  },
  "errors": [],
  "request_id": "req_rep789xyz012"
}
```

### Result fields

| Field              | Type           | Description                                                               |
| ------------------ | -------------- | ------------------------------------------------------------------------- |
| `comment_id`       | string         | The comment that was replied to                                           |
| `reply_text`       | string         | The generated reply text                                                  |
| `reply_dialect`    | string \| null | Dialect used in the reply (matches original). `null` for English replies. |
| `tone`             | string         | The tone used for the reply                                               |
| `original_intent`  | string         | Detected intent of the original comment                                   |
| `original_dialect` | string         | Detected dialect of the original comment                                  |
