Get replies (comments) on a social media post, comment, or a reply.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');
// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });
async function run() {
// Load the profile
const profile = await sdk.getProfile('social-media/replies@1.0.1');
// Use the profile
const result = await profile
.getUseCase('GetPostReplies')
.perform({
parentId: 'be7cdc05-4264-4d47-bc1f-af704d6abf32'
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"parentId": "be7cdc05-4264-4d47-bc1f-af704d6abf32"
}
{
"replies": [
{
"id": "123",
"createdAt": "2022-06-09T13:29:11+02:00",
"authorId": "@alberteinstein",
"authorName": "Albert Einstein",
"text": "Hello, World!"
}
]
}