Workflows · From Tasks · from_x

Purpose

Imports data from X (previously Twitter).
Depending on the level of access of your X Developer App, you have access to different parts of the API. All users of Workflows can make use of the Onesecondbefore Developer App of X. The following task types are currently supported:

  1. Free level of access:
    1. /2/users/me
  2. Basic level of access:
    1. /2/tweets/counts/recent
    2. /2/users/:id/tweets
  3. Enterprise or Academic Research level of access:
    1. /2/tweets/counts/all

Onesecondbefore Support can add more imports at demand.

Task Type: /2/users/me

Returns information about an authorized user.

Properties

propertytyperequireddescription
typeenumerator (see description)yesMust be /2/users/me.
fieldsarray of stringsnoList of fields you want to have in the table. All fields will be added if this property is left out of the configuration
conn_idstringnoConnection string as handed to you by the Onesecondbefore team. Default is x

Example usage

task:
    type: from_x

extract:
    type: /2/users/me

Task Type: /2/tweets/counts/recent

The recent Tweet counts endpoint returns count of Tweets from the last seven days that match a query.

Properties

propertytyperequireddescription
typeenumerator (see description)yesMust be /2/tweets/counts/recent.
querystringyesOne query for matching Tweets. You can learn how to build this query by reading our build a query guide.

If you have Essential or Elevated access, you can use the Basic operators when building your query and can make queries up to 512 characters long. If you have been approved for Academic Research access, you can use all available operators and can make queries up to 1,024 characters long.

Learn more about our access levels on the about Twitter API page.
start_timedate (ISO 8601)noYYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). The oldest UTC timestamp (from most recent seven days) from which the Tweet counts will be provided. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). If included with the same request as a since_id parameter, only since_id will be used. By default, a request will return Tweet counts from up to seven days ago if you do not include this parameter.
end_timedate (ISO 8601)noYYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). The newest, most recent UTC timestamp to which the Tweet counts will be provided. Timestamp is in second granularity and is exclusive (for example, 12:00:01 excludes the first second of the minute). By default, a request will return Tweet counts from as recent as 30 seconds ago if you do not include this parameter.
granularityenumerator (minute, hour, day)noThis is the granularity that you want the timeseries count data to be grouped by. You can request minute, hour, or day granularity. The default granularity, if not specified is hour.
since_idstringnoReturns results with a Tweet ID greater than (that is, more recent than) the specified ID. The ID specified is exclusive and responses will not include it. If included with the same request as a start_time parameter, only since_id will be used.
until_idstringnoReturns results with a Tweet ID less than (that is, older than) the specified ID. The ID specified is exclusive and responses will not include it.
conn_idstringnoConnection string as handed to you by the Onesecondbefore team. Default is x

Example usage

task:
    type: from_x

extract:
    type: /2/tweets/counts/recent
    query: #onesecondbefore

Task Type: /2/users/:id/tweets

Returns Tweets composed by a single user, specified by the requested user ID. By default, the most recent ten Tweets are returned per request. Using pagination, the most recent 3,200 Tweets can be retrieved.

The Tweets returned by this endpoint count towards the Project-level Tweet cap.

Properties

propertytyperequireddescription
typeenumerator (see description)yesMust be /2/users/:id/tweets Replace :id with the use the user id.

Unique identifier of the Twitter account (user ID) for whom to return results. User ID can be referenced using the user/lookup endpoint. More information on Twitter IDs is here.
end_timedate (ISO 8601)noYYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). The newest or most recent UTC timestamp from which the Tweets will be provided. Only the 3200 most recent Tweets are available. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). Minimum allowable time is 2010-11-06T00:00:01Z

Please note that this parameter does not support a millisecond value.
start_timedate (ISO 8601)noYYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). The oldest or earliest UTC timestamp from which the Tweets will be provided. Only the 3200 most recent Tweets are available. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). Minimum allowable time is 2010-11-06T00:00:00Z

Please note that this parameter does not support a millisecond value.
end_timedate (ISO 8601)noYYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). The newest, most recent UTC timestamp to which the Tweet counts will be provided. Timestamp is in second granularity and is exclusive (for example, 12:00:01 excludes the first second of the minute). By default, a request will return Tweet counts from as recent as 30 seconds ago if you do not include this parameter.
excludeenumerator (retweets, replies)noComma-separated list of the types of Tweets to exclude from the response. When exclude=retweets is used, the maximum historical Tweets returned is still 3200. When the exclude=replies parameter is used for any value, only the most recent 800 Tweets are available.
max_resultsintegernoSpecifies the number of Tweets to try and retrieve, up to a maximum of 100 per distinct request. By default, 10 results are returned if this parameter is not supplied. The minimum permitted value is 5. It is possible to receive less than the max_results per request throughout the pagination process.
since_idstringnoReturns results with a Tweet ID greater than (that is, more recent than) the specified 'since' Tweet ID. Only the 3200 most recent Tweets are available. The result will exclude the since_id. If the limit of Tweets has occurred since the since_id, the since_id will be forced to the oldest ID available.
until_idstringnoReturns results with a Tweet ID less than (that is, older than) the specified 'until' Tweet ID. Only the 3200 most recent Tweets are available. The result will exclude the until_id. If the limit of Tweets has occurred since the until_id, the until_id will be forced to the most recent ID available.
expansionsenumerator (attachments.poll_ids, attachments.media_keys, author_id, edit_history_tweet_ids, entities.mentions.username, geo.place_id, in_reply_to_user_id, referenced_tweets.id, referenced_tweets.id.author_id)noExpansions enable you to request additional data objects that relate to the originally returned Tweets. Submit a list of desired expansions in a comma-separated list without spaces. The ID that represents the expanded data object will be included directly in the Tweet data object, but the expanded object metadata will be returned within the includes response object, and will also include the ID so that you can match this data object to the original Tweet object.

The following data objects can be expanded using this parameter:
  • The Tweet author's user object
  • The user object of the Tweet’s author that the original Tweet is responding to
  • Any mentioned users’ object
  • Any referenced Tweets’ author’s user object
  • Attached media’s object
  • Attached poll’s object
  • Attached place’s object
  • Any referenced Tweets’ object (this includes Tweet objects for previous versions of an edited Tweet).
media.fieldsenumerator (duration_ms, height, media_key, preview_image_url, type, url, width, public_metrics, non_public_metrics, organic_metrics, promoted_metrics, alt_text, variants)noThis fields parameter enables you to select which specific media fields will deliver in each returned Tweet. Specify the desired fields in a comma-separated list without spaces between commas and fields. The Tweet will only return media fields if the Tweet contains media and if you've also included the expansions=attachments.media_keys query parameter in your request. While the media ID will be located in the Tweet object, you will find this ID and all additional media fields in the includes data object.
place.fieldsenumerator (contained_within, country, country_code, full_name, geo, id, name, place_type)noThis fields parameter enables you to select which specific place fields will deliver in each returned Tweet. Specify the desired fields in a comma-separated list without spaces between commas and fields. The Tweet will only return place fields if the Tweet contains a place and if you've also included the expansions=geo.place_id query parameter in your request. While the place ID will be located in the Tweet object, you will find this ID and all additional place fields in the includes data object.
poll.fieldsenumerator (duration_minutes, end_datetime, id, options, voting_status)noThis fields parameter enables you to select which specific poll fields will deliver in each returned Tweet. Specify the desired fields in a comma-separated list without spaces between commas and fields. The Tweet will only return poll fields if the Tweet contains a poll and if you've also included the expansions=attachments.poll_ids query parameter in your request. While the poll ID will be located in the Tweet object, you will find this ID and all additional poll fields in the includes data object.
tweet.fieldsenumerator (attachments, author_id, context_annotations, conversation_id, created_at, edit_controls, entities, geo, id, in_reply_to_user_id, lang, non_public_metrics, public_metrics, organic_metrics, promoted_metrics, possibly_sensitive, referenced_tweets, reply_settings, source, text, withheld)noThis fields parameter enables you to select which specific Tweet fields will deliver in each returned Tweet object. Specify the desired fields in a comma-separated list without spaces between commas and fields. You can also pass the expansions=referenced_tweets.id expansion to return the specified fields for both the original Tweet and any included referenced Tweets. The requested Tweet fields will display in both the original Tweet data object, as well as in the referenced Tweet expanded data object that will be located in the includes data object.
user.fieldsenumerator (created_at, description, entities, id, location, most_recent_tweet_id, name, pinned_tweet_id, profile_image_url, protected, public_metrics, url, username, verified, verified_type, withheld)noThis fields parameter enables you to select which specific user fields will deliver in each returned Tweet. Specify the desired fields in a comma-separated list without spaces between commas and fields. While the user ID will be located in the original Tweet object, you will find this ID and all additional user fields in the includes data object. You must also pass one of the user expansions to return the desired user fields:
  • expansions=author_id
  • expansions=entities.mentions.username
  • expansions=in_reply_to_user_id
  • expansions=referenced_tweets.id.author_id
conn_idstringnoConnection string as handed to you by the Onesecondbefore team. Default is x

Example usage

extract:
    type: /2/users/17428519/tweets
    tweet.fields:
        - id
        - text
        - author_id
        - attachments
        - context_annotations
        - conversation_id
        - created_at
        - edit_controls
        - entities
        - geo
        - in_reply_to_user_id
        - lang
        - public_metrics
        - possibly_sensitive
        - referenced_tweets
        - source
        - withheld

        # YOU NEED EXTRA AUTHORIZATION BY X FOR THESE DIMENSIONS
        # - non_public_metrics
        # - organic_metrics
        # - promoted_metrics
        # - reply_settings
        
    user.fields:
        - created_at
        - description
        - entities
        - id
        - location
        - most_recent_tweet_id
        - name
        - pinned_tweet_id
        - profile_image_url
        - protected
        - public_metrics
        - url
        - username
        - verified
        - verified_type
        - withheld

Task Type: /2/tweets/counts/all

This endpoint is only available to those users who have been approved for Academic Research access or Enterprise access.

The full-archive Tweet counts endpoint returns the count of Tweets that match your query from the complete history of public Tweets; since the first Tweet was created March 26, 2006.

Properties

propertytyperequireddescription
typeenumerator (see description)yesMust be /2/tweets/counts/all.
querystringyesOne query for matching Tweets. You can learn how to build this query by reading our build a query guide. You can use all available operators and can make queries up to 1,024 characters long.
end_timedate (ISO 8601)noYYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). Used with start_time. The newest, most recent UTC timestamp to which the Tweets will be provided. Timestamp is in second granularity and is exclusive (for example, 12:00:01 excludes the first second of the minute). If used without start_time, Tweets from 30 days before end_time will be returned by default. If not specified, end_time will default to [now - 30 seconds].
granularityenumerator (minute, hour, day)noThis is the granularity that you want the timeseries count data to be grouped by. You can request minute, hour, or day granularity. The default granularity, if not specified is hour.
since_idstringnoReturns results with a Tweet ID greater than (that is, more recent than) the specified ID. The ID specified is exclusive and responses will not include it. If included with the same request as a start_time parameter, only since_id will be used.
start_timedate (ISO 8601)noYYYY-MM-DDTHH:mm:ssZ (ISO 8601/RFC 3339). The oldest UTC timestamp from which the Tweets will be provided. Timestamp is in second granularity and is inclusive (for example, 12:00:01 includes the first second of the minute). By default, a request will return Tweets from up to 30 days ago if you do not include this parameter.
until_idstringnoReturns results with a Tweet ID less than (that is, older than) the specified ID. Used with since_id. The ID specified is exclusive and responses will not include it.
conn_idstringnoConnection string as handed to you by the Onesecondbefore team. Default is x

Example usage

task:
    type: from_x

extract:
    type: /2/tweets/counts/all
    query: #onesecondbefore

Details

itemdescription
APITwitter API
Pre-formatted schemaYes. Comes with a pre-formatted and described schema.