ETTwitter icon

ETTwitter

Consume Twitter API

Actions6

Overview

The ETTwitter node for n8n enables users to interact with the Twitter API, specifically to create tweets programmatically. The "Tweet → Create" operation allows you to post new tweets from your workflow, optionally including media attachments, location data, and other metadata. This is useful for automating social media updates, broadcasting alerts, or integrating Twitter posting into larger automation pipelines.

Example scenarios:

  • Automatically tweet status updates when a new blog post is published.
  • Post images or videos to Twitter as part of a marketing campaign.
  • Send location-tagged tweets based on IoT device triggers.

Properties

Name Type Meaning
Text String The content of the tweet. This is the main text that will be posted. URL encoding may be necessary; t.co link wrapping affects character count.
Additional Fields Collection Optional extra parameters for the tweet (see below).

Additional Fields options:

Name Type Meaning
Attachments String Comma-separated names of binary properties containing files to upload as media attachments to the tweet.
Display Coordinates Boolean Whether to pin the exact coordinates from which the tweet was sent.
In Reply to Tweet String The ID of an existing tweet to reply to.
Location FixedCollection Latitude and longitude to geotag the tweet.
Possibly Sensitive Boolean Indicates if the tweet contains sensitive content (e.g., nudity, medical procedures).

Output

The output is a JSON object representing the created tweet, as returned by the Twitter API. Typical fields include:

{
  "created_at": "...",
  "id": 1234567890,
  "text": "...",
  "user": { ... },
  "entities": { ... },
  // ...other standard Twitter status fields
}
  • If media attachments are included, the entities and extended_entities fields will contain information about the uploaded media.
  • No binary output is produced directly; all data is in JSON format.

Dependencies

  • External Service: Requires access to the Twitter API.
  • Credentials: You must configure Twitter OAuth1 credentials (twitterOAuth1Api) in n8n.
  • Environment: No special environment variables required beyond n8n's credential setup.

Troubleshooting

Common issues:

  • Authentication errors: Ensure your Twitter credentials are valid and have write permissions.
  • Media upload failures: Check that the binary property names match those provided in the "Attachments" field, and that file types/sizes comply with Twitter's requirements.
  • Character limit exceeded: Tweets exceeding Twitter's character limit will result in an error.
  • Invalid location data: Latitude and longitude must be valid numbers; otherwise, the API call may fail.

Error messages:

  • "error": "Status is over 280 characters."
    Solution: Shorten the tweet text.
  • "error": "Invalid or expired token."
    Solution: Re-authenticate your Twitter credentials in n8n.
  • "error": "Media type unrecognized."
    Solution: Ensure attached files are supported by Twitter (e.g., JPEG, PNG, MP4).

Links and References

Discussion