Retrieve social media profiles (pages, accounts) the authenticated user is authorized to publish to.
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/publishing-profiles@1.0.1');
// Use the profile
const result = await profile
.getUseCase('GetProfilesForPublishing')
.perform({}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"profiles": [
{
"id": "110658944785122",
"name": "Sf-test",
"username": "sftest7904",
"imageUrl": "https://scontent-prg1-1.xx.fbcdn.net/v/t39.30808-1/cp0/p50x50/263679317_110659048118445_8251344428401368545_n.png?_nc_cat=103&ccb=1-5&_nc_sid=dbb9e7&_nc_ohc=kN4tKgxAWdYAX_B0I6K&_nc_ht=scontent-prg1-1.xx&edm=AGaHXAAEAAAA&oh=00_AT8KpGTOc-H8gJrtOJwvNasfXrW8I27s0h1T5a8_nxUeyg&oe=61EDD39E"
}
]
}