Plugin: Twitter V2 API gatherer
Other versions of this plugin may exist. Please ensure you are viewing the documentation for the version that you are currently using. If you are not running the latest version of your plugin we recommend upgrading. See: list of all available versions of this plugin. |
Purpose
This plugin is used to index content form Twitter API. It uses Twitter V2 API: https://developer.twitter.com/en/docs/twitter-api The plugin will output JSON file that should be handled further with built-in Funnelback filters. See: xref:build/data-sources/document-filtering/builtin-filters-json-to-xml.adoc By default, the most recent ten Tweets are returned per request. Using pagination, the most recent 3,200 Tweets can be retrieved.
Usage
Create a custom data source
This plugin must be used in conjunction with a custom data source. Before using this plugin ensure you have created a custom data source, then enable the plugin on this data source.
Enable the plugin
Enable the twitter-v2-api-gatherer plugin on your custom data source from the extensions screen in the administration dashboard or add the following <results page|data source> configuration to enable the plugin.
plugin.twitter-v2-api-gatherer.enabled=true
plugin.twitter-v2-api-gatherer.version=1.0.0
This plugin requires a full update of the data source to take effect. |
Plugin configuration settings
-
plugin.twitter-v2-api-gatherer.encrypted.bearerToken
(Required): The user access token for access to the Instagram API. See: https://developer.twitter.com/en/docs/authentication/oauth-2-0/bearer-tokens for more information -
plugin.twitter-v2-api-gatherer.encrypted.userName
(Required*) The one in your profile after @ sign. It will be used to retrieveuserId
. -
plugin.twitter-v2-api-gatherer.encrypted.userId
(Required*) Twitter userId (if known)
*NOTE: You need to provideuserName
oruserId
(or you can both).
NOTE: If you want to have Tweet URLs created withuserName
:https://twitter.com/<userName>/status/<tweetId>
, you need to provide it as a config key (read above). If you don’t provideuserName
the URLs will be created withuserId
:https://twitter.com/<userId>/status/<tweetId>
By default, plugin will request only tweetId and tweetText fields form API.
{
"edit_history_tweet_ids": [
"123456123456"
],
"id": "123456123456",
"text": "Congratulations to Professor John Doe on receiving...."
},
Additional fields can be requested: https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-tweets
Example
The syntax to request additional fields is:
-
plugin.twitter-v2-api-gatherer.queryParameters.<option_name>=<option_value>
To get the created_at
field from tweet.fields
add this line to your config:
-
plugin.twitter-v2-api-gatherer.queryParameters.tweet.fields=created_at
For created_at
and author_id
field from tweet.fields
:
-
plugin.twitter-v2-api-gatherer.queryParameters.tweet.fields=created_at,author_id
If you only need tweets after specific date:
-
plugin.twitter-v2-api-gatherer.queryParameters.start_time=2023-04-01T13:03:36.000Z