Twitter Search
The Twitter Search macro returns data about tweets matching a specified query, subject to limits set by Twitter:
The data from up to 100 tweets can be returned.
Up to 450 queries can be executed per 15 minute period.
Twitter's search service is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface.
To use the Twitter Search macro, you must have a Twitter account and register a Twitter app.
Twitter Search configuration parameters
The Twitter Search macro has a single set of configuration parameters in addition to the standard execution options:
All of these words | Words which must be present in the returned tweets, separated by spaces. To return only tweets with a positive attitude, include :) as one of the words. To return only tweets with a negative attitude, include :( as one of the words. |
The exact phrase | Exact phrase which must be present in the returned tweets. |
Any of these words | Space-separated list of words, one or more of which must be present in the returned tweets. |
None of these words | Space-separated list of words, none of which may be present in the returned tweets. |
These hashtags | Space-separated list of hashtags, one or more of which must be present in the returned tweets. Omit the # "hashtag" character. |
From these accounts | Space-separated list of Twitter IDs, from which any of the returned tweets were sent. Omit the @ "at" character. |
To these accounts | Space-separated list of Twitter IDs, to which any of the returned tweets were sent. Omit the @ "at" character. |
Mentioning these accounts | Space-separated list of Twitter IDs, any of which were mentioned in the returned tweets. Omit the @ "at" character. |
Near this place (lat,lon) | Location (latitude/longitude) and radius from which the returned tweets either originated (because they were tagged with the location) or were sent by a user whose profile location is within that area. |
Since ID | Requests tweets with an ID greater than (that is, more recent than) to Since ID. If this number exceeds Twitter's tweet limit, Since ID will be replaced with the oldest ID available. |
Max ID | Requests tweets with an ID less than (that is, older than) or equal to Max ID. |
API key | Validation codes generated on the Twitter Developers' web site. See Configuring the Twitter Search macro. |
Configure the Twitter Search macro
Visit the Twitter Developers' web site and enter your Twitter user name and password.
Select Create New App and enter Application details:
Enter application Name.
Enter application Description.
Enter application Website. This must be a valid URL, including the http prefix.
Select the API Keys tab on your app's Twitter page, and then copy the API key and API secret.
Select the Twitter Search macro, and then go to the Configuration tab on the Properties pane.
Enter your Search query:
All of these words | Words which must be present in the returned tweets, separated by spaces. To return only tweets with a positive attitude, include :) as one of the words. To return only tweets with a negative attitude, include :( as one of the words. |
The exact phrase | Exact phrase which must be present in the returned tweets. |
Any of these words | Space-separated list of words, one or more of which must be present in the returned tweets. |
None of these words | Space-separated list of words, none of which may be present in the returned tweets. |
These hashtags | Space-separated list of hashtags, one or more of which must be present in the returned tweets. Omit the # "hashtag" character. |
From these accounts | Space-separated list of Twitter IDs, from which any of the returned tweets were sent. Omit the @ "at" character. |
To these accounts | Space-separated list of Twitter ID, to which any of the returned tweets were sent. Omit the @ "at" character. |
Mentioning these accounts | Space-separated list of Twitter IDs, any of which were mentioned in the returned tweets. Omit the @ "at" character. |
Near this place (lat,lon) | Location (latitude/longitude) and radius from which the returned tweets either originated (because they were tagged with the location) or were sent by a user whose profile location is within that area. |
Since ID | Requests tweets with an ID greater than (that is, more recent than) to Since ID. If this number exceeds Twitter's tweet limit, Since ID will be replaced with the oldest ID available. |
Max ID | Requests tweets with an ID less than (that is, older than) or equal to Max ID. |
Optionally, go to the Execution tab, and then set Web service options.
Twitter Search output fields
The following are the output streams and fields for the Twitter Search macro:
![image-20240402-151218.png](../__attachments/3918102547/image-20240402-151218.png?inst-v=c3007bf4-8f91-43d3-9633-90859273c945)
Coordinates (C)
results_ID | Index of the result generated by the project. Integer. |
longitude | Longitude of the tweet indicated by results_id. Decimal. |
latitude | Latitude of the tweet indicated by results_id. Decimal. |
Hashtags (H)
hashtags_ID | Index of the hashtag generated by the project. Integer. |
results_ID | Index of the result generated by the project. Integer. |
text | Hashtag with preceding hash character # omitted. Unicode string. |
Results (R)
results_ID | Index of the result generated by the project. Integer. |
root_ID | Index of the query generated by the project. Integer. |
created_at | Creation timestamp of the tweet. DateTime. |
from_user | Twitter ID of the tweet sender. Unicode string. |
from_user_id | Numerical Twitter ID of the tweet sender. Integer. |
from_user_name | Display name of the tweet sender. Unicode string. |
id | Numerical ID of the tweet. Integer. |
iso_language_code | ISO language code of the tweet. TextVar string. |
result_type | Should always be recent, indicating that the most recent results have been requested. TextVar string. |
profile_image_url | URL of the tweet sender's profile image. Unicode string. |
profile_image_url_https | HTTPS URL of the tweet sender's profile image. Unicode string. |
source | Tweet source (URL). Unicode string. |
text | Text of the tweet. Unicode string. |
to_user | Twitter ID to which the tweet is responding. Unicode string. |
to user_id | Numerical Twitter ID to which the tweet is responding. Integer. |
in_reply_to_status_id | Numerical ID of the tweet to which the tweet is responding. Integer. |
Root (R1)
root_ID | Index of the query generated by the project. Integer. |
completed_in | Length of time (in seconds) the query took. Decimal. |
max_id | Maximum ID of the tweets returned. Integers. |
query | Query string that was transmitted to Twitter. Unicode string. |
refresh_url | Query string with the same search terms that could be transmitted if the tweets subsequent to the ones returned were desired. Contains since_id value, which can be used in subsequent requests. Unicode string. |
count | Number of tweets returned. Integer. |
since_id | since_id requested. If no since_id was specified, returns 0. Integers. |
URLs (U)
urls_ID | Index of the URL generated by the project. Integer. |
results_ID | Index of the result generated by the project. Integer. |
display_url | Expanded target URL as displayed by Twitter. Unicode string. |
expanded_url | Expanded target URL. Unicode string. |
url | Twitter-shortened URL. Unicode string. |
UserMentions (U1)
user_mentions_ID | Index of the Twitter user mention generated by the project. Integer. |
results_ID | Index of the result generated by the project. Integer. |
id | Numerical Twitter ID of the user mentioned. Integer. |
name | User name of the Twitter user mentioned. Unicode string. |
screen_name | Twitter ID of the user mentioned. Unicode string. |