Skip to content
✨ Learn more about Convo Space & Omnid →
Docs
Convo SDK
Comments

SDK - Comments

Create a Comment

convo.comments.create(
    signerAddress,  // Ethereum Address or NEAR Public Key
    token, // JWT Auth Token
    comment,  // Comment text
    threadId,  // Unique threadId
    url // Url of the page where the message is from.
)

Example,

let resp = await convo.comments.create(
    accounts[0],
    "",
    "New",
    "KIGZUnR4RzXDFheXoOwo",
    encodeURIComponent('https://theconvo.space/')
);

Delete a Comment

convo.comments.delete(
    signerAddress,  // Ethereum Address or NEAR Public Key
    token, // JWT Auth Token
    commentId // Comment ID
)

Example,

let resp = await convo.comments.delete(
    accounts[0],
    "",
    "KIGZUnR4RzXDFheXoOwo"
);

Nuke All Comments

convo.comments.nuke(
    signerAddress,  // Ethereum Address or NEAR Public Key
    token, // JWT Auth Token
)

Example,

let resp = await convo.comments.nuke(
    accounts[0],
    ""
);

Update a Comment

convo.comments.update(
    signerAddress,  // Ethereum Address or NEAR Public Key
    token, // JWT Auth Token
    commentId, // Comment ID
    comment // New Comment Text.
)

Example,

let resp = await convo.comments.update(
    accounts[0],
    "",
    "01fyv0qsprperxt1y63zrgyqfq",
    "Hey"
);

Toggle Upvote

convo.comments.toggleUpvote(
    signerAddress,  // Ethereum Address or NEAR Public Key
    token, // JWT Auth Token
    commentId // Comment ID
)

Example,

let resp = await convo.comments.toggleUpvote(
    accounts[0],
    "",
    "KIGZUnR4RzXDFheXoOwo"
);

Toggle Downvote

convo.comments.toggleDownvote(
    signerAddress,  // Ethereum Address or NEAR Public Key
    token,          // JWT Auth Token
    commentId       // Comment ID
)

Example,

let resp = await convo.comments.toggleDownvote(
    accounts[0],
    "",
    "KIGZUnR4RzXDFheXoOwo"
);

Query Comments

convo.comments.query({
    threadId,   // Unique ThreadId
    url,        // Origin URL
    author,     // Blockchain Wallet Address
    tag1,       // Custom Tag
    tag2,       // Custom Tag
    replyTo,    // CommentId of the original Comment
    latestFirst,// Return Newer on the top
    page,       // Paginiate Response, Page Number: 0-n
    pageSize,   // Paginiate Response, Page Size
    airdrop,    // Boolean, `true`or `false` (default)
})

Examples,

// query by website
let resp = await convo.comments.query({
    url:"https://theconvo.space/"
});
 
// query by NFT , ref: https://docs.theconvo.space/docs/Convo-API/standards
let resp = await convo.comments.query({
    threadId:"0x492D7C407d78D170AF70Ce53578a4Ec839da0ebd:152:1",
    url:"https://opensea.io/",
});