Publish Social Media Post

social-media/publish-post@2.0.0
Supported by 5 providers
F
I
L
P
T

Publish a Post

Publish a post on a social media profile with optional image or video attachments.

Input
Profile ID
Text
Link
Title
Media attachments
Video IDs
Result
Post ID
Post URL

1.Choose a provider

2.Use PublishPost with mock in your code

npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

const sdk = new SuperfaceClient();

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('social-media/publish-post@2.0.0');

  // 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();

Structure details

Input (object)

profileId
Identifier of a profile to publish to. May be optional with some providers.
text
Text of the post
link
URL to attach to the post
title
Title of the post, if supported by the provider (e.g. Pinterest). Ignored otherwise.
media
Only images and gifs are supported
videos
IDs of previously uploaded videos (see `social-media/upload-from-url`) to be attached or published.

Example

{
  "profileId": "110658944785122",
  "text": "Text of the Post."
}

Result (object)

postId
Identifier of the published post.
url
Link to the published post.

Example

{
  "postId": "110658944785122_125682506616099",
  "url": "https://www.facebook.com/110658944785122/posts/125682506616099/"
}

Implementation details

Provider
mock
Use case
PublishPost
Author
@superface
Source
Verified