Create Reply

Create Reply

To create a reply to a previous comment, call the POST /comments API with the message of the new comment, as well as the ID of the previous comment to leave the reply on.

cURL
curl -X POST https://api.box.com/2.0/comments \
     -H 'Authorization: Bearer <ACCESS_TOKEN>'
     -H 'Content-Type: application/json" '
     -d '{
       "message": "I agree with this.",
       "item": {
         "type": "comment",
         "id": 345344
       }
     }
Java
BoxComment comment = new BoxComment(api, "id");
comment.reply("I agree with this!");
Python
reply_comment = client.comment(comment_id='12345').reply('If possible, please finish this by the end of the week!')
Node
// Reply to the comment with ID 11111
client.comments.reply('11111', 'Yes, this is the latest version.')
    .then(comment => {
        /* comment -> {
            type: 'comment',
            id: '44444',
            is_reply_comment: true,
            message: 'Yes, this is the latest version',
            created_by: 
            { type: 'user',
                id: '55555',
                name: 'Example User 2',
                login: 'user2@example.com' },
            created_at: '2012-12-13T07:19:08-08:00',
            item: { id: '33333', type: 'file' },
            modified_at: '2012-12-13T07:19:08-08:00' }
        */
    });

A reply's message can also mentions users using the @ sign. To do so, add the string @[userid:name] anywhere within the message. The user_id is the target user's ID, where the name can be any custom phrase. In the Box UI this name will link to the user's profile.

Then, pass this string as the tagged_message instead of the message.

cURL
curl -X POST https://api.box.com/2.0/comments \
     -H 'Authorization: Bearer <ACCESS_TOKEN>'
     -H 'Content-Type: application/json" '
     -d '{
       "message": " @[1234:John], I agree with this.",
       "item": {
         "type": "comment",
         "id": 345344
       }
     }
Java
BoxComment comment = new BoxComment(api, "id");
comment.reply("@[1234:user@box.com] I agree with this!");
Python
reply_comment = client.comment(comment_id='12345').reply('@[33333:John Doe], if possible, please finish this by the end of the week!')
Node
client.comments.createTaggedReply('11111', '@[22222:Sam] Yes, this is the most recent version!')
    .then(comment => {
        /* comment -> {
            type: 'comment',
            id: '44444',
            is_reply_comment: false,
            tagged_message: '@[22222:Sam] Yes, this is the most recent version!',
            created_by: 
            { type: 'user',
                id: '55555',
                name: 'Example User 2',
                login: 'user2@example.com' },
            created_at: '2012-12-13T07:19:08-08:00',
            item: { id: '33333', type: 'file' },
            modified_at: '2012-12-13T07:19:08-08:00' }
        */
    });