Publish a post on a social media profile with optional image or video attachments.
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/publish-post@2.0.1');
// Use the profile
const result = await profile
.getUseCase('PublishPost')
.perform({
profileId: '110658944785122',
text: 'Text of the Post.'
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"profileId": "110658944785122",
"text": "Text of the Post."
}
{
"postId": "110658944785122_125682506616099",
"url": "https://www.facebook.com/110658944785122/posts/125682506616099/"
}