Twitter

The Twitter source can use several Twitter API endpoints out of the box: @mentions, Twitter lists, user timeline, and standard search.

Configuration Options

  • module (required): twitter
  • api_key (required): Consumer API key (See Twitter oauth docs).
  • api_secret_key (required): Consumer API secret key (See Twitter oauth docs).
  • access_token (required): Twitter access token (See Twitter oauth docs).
  • access_token_secret (required): Twitter access token secret (See Twitter oauth docs).
  • defanged_only: Defaults to true. If set to false, the Twitter source will include all expanded links found in Tweets. If set to true, it will include only defanged links.

After the above general options, you may include valid options for one of the supported Twitter endpoints, as described below. (If you do not include any extra options, the Twitter plugin will default to reading from your @mentions.) Any extra options defined in the config will be passed in directly to the Twitter endpoint, so you can configure some extra options not shown here. See the relevant Twitter documentation for more information on supported parameters.

Mentions:

This is the default behavior.

Twitter list:

  • owner_screen_name: Twitter user who owns the list.
  • slug: The name of the Twitter list.

Twitter user timeline:

  • screen_name: Twitter user to watch.

Twitter search:

  • q: Twitter search term, can be multiple words including hashtags.

Example Configuration

The following examples all assume Twitter credentials have already been configured in the credentials section of the config, like this:

credentials:
  - name: twitter-auth
    api_key: MY_KEY
    api_secret_key: MY_SECRET_KEY
    access_token: MY_TOKEN
    access_token_secret: MY_TOKEN_SECRET

Inside the sources section of the config, create a new item for the source you wish to define. Examples for each of the supported Twitter endpoints are provided below.

Mentions:

- name: twitter-my-mentions
  module: twitter
  credentials: twitter-auth

Twitter list:

- name: twitter-inquest-c2-list
  module: twitter
  credentials: twitter-auth
  owner_screen_name: InQuest
  slug: c2-feed

Twitter user timeline:

- name:twitter-inquest-timeline
  module: twitter
  credentials: twitter-auth
  screen_name: InQuest

Twitter search:

- name: twitter-open-directory
  module: twitter
  credentials: twitter-auth
  q: '"open directory" #malware'

Note

When searching for Twitter hashtags, be sure to put quotes around your search term, as shown in the example above. Otherwise, the # character will be treated as the beginning of a YAML comment.