4 min read

createPost Documentation

Purpose

This node is designed to facilitate the creation of posts within a specified platform, leveraging an integration with the Meta Threads API. This functionality allows users to generate content by providing text and optional media, which will be posted on their behalf. The primary objective of createPost is to streamline the process of sharing updates, announcements, or any kind of communication within the Meta Threads ecosystem.

Settings

This node accepts various settings, detailed as follows:

1. text

2. mediaType

3. imageUrl

4. videoUrl

How It Works

Upon invocation, the node first gathers input values from the inputs and config objects. It prioritizes inputs over config and assigns defaults if necessary.

  1. Validation: The function checks for the presence of the text input. If text is absent, it returns an error message indicating that the text is required.

  2. Integration Setup: The function utilizes the integration connection to establish a connection to the Meta Threads API under the context provided.

  3. Post Creation: It calls the createThreadsPost method on the integration object, passing along necessary parameters like text, mediaType, imageUrl, and videoUrl.

  4. Error Handling: If any errors occur during the API call, they are caught and returned as an error message specifying that an internal error has occurred.

  5. Output: If the post creation is successful, the output data returned from the API is handed back as an output1 field.

Use Cases & Examples

Use Cases

  1. Social Media Management Tool: A business uses createPost to automatically post updates, offers, or announcements on their Meta Threads profile from an analytics or management platform.

  2. Marketing Campaigns: A digital marketing agency can utilize createPost to publish promotional content, including stunning visuals and engaging video clips, directly to target audiences.

  3. Event Notifications: An event organizer might implement this functionality in an application to announce upcoming events in real-time, supporting image and video previews.

Example Configuration

Scenario: A marketing agency wants to announce a new product launch by posting a text update with an accompanying promotional image.

Configuration Data:

json
{
  "inputs": {
    "text": "🚀 Exciting News! We're thrilled to launch our latest product. Check it out!",
    "mediaType": "IMAGE",
    "imageUrl": "https://example.com/images/product-launch.png",
    "videoUrl": ""
  },
  "config": {
    "text": "Fallback announcement text (not used in this case)",
    "mediaType": "TEXT",
    "imageUrl": "",
    "videoUrl": ""
  },
  "context": {
    "user": "exampleUserId"
  }
}

Explanation: In this example, the text field contains a compelling announcement about the product. The mediaType is set to "IMAGE" to indicate that there is an associated image. The imageUrl points to the promotional graphic, while videoUrl is left empty since no video content is necessary for this announcement. This setup ensures effective communication and media sharing on Meta Threads.