Details
| ID | Twitter |
|---|---|
| Provider | X Corp |
| Category | Utilities |
| From Version | 6.0.0 |
| Docker Image | demisto/tweepy:1.0.0.23810 |
| Supported Modules | Agentix XSIAM |
README
Definitions
Entities: Provide metadata about context posted on Twitter. Examples of entities include hashtags, user mentions, links, stock images, symbols, polls, and attached media.
Relevant Result - A result that may be of interest to the person conducting the search; Any result that appears within the first 30 results of the customized search
Non-Relevant Result - Any result that is does not classify as a Relevant-Result
Public Account - A Twitter account that anyone can view. All of the information shared by the account is viewable by the general public.
Public Metrics - Public information about the account. Includes Followers Count, Following Count, Listed Count, and Tweet count.
Private Account - A Twitter account that only an approved list of people can view. All of the information shared by the account is viewable by only those who have sent requests to follow the private account and the owner of the account has accepted the request
Requirements
Authentication
Twitter requires authentication for most of its endpoints. There are 5 main credentials within Twitter’s Authentication:
API Key - Like a username, this allows you to make a request on behalf of your app when combined with API Key Secret.
API Key Secret - Like a password, this allows you to make a request on behalf of your app when combined with API Key.
Access Token - This token allows you to make a request on behalf of the Twitter account that owns the App when combined with the Access token secret.
Access Token Secret - This token allows you to make a request on behalf of the Twitter account that owns the App when combined with the Access token.
Bearer Token - A credential used to allow the app to authenticate requests that do not require the API Keys or Access tokens.
Clients will need to provide their own API Key, API Key Secret, Access token, Access Token Secret, and Bearer Token. Since Twitter has a request limit, the customer will need to use their own keys. This allows each user to have their own rate limit rather than the community sharing a rate limit. In cases where API keys are not needed, just the Bearer Token will suffice. Tweepy has a built-in OAuth handler; and Twitter uses OAuth to authenticate its users. By storing the user’s API Key, API Secret Key, Access token, and Access Token Secret in an integration parameter and passing them to Tweepy’s OAuth Handler, the user’s requests can get authenticated automatically. The stored keys/tokens will be encrypted to protect the confidentiality of the user’s information. After installing the integration, the user can navigate to Settings > Integrations > Twitter Integration > Add Instance, and enter their keys/tokens in the corresponding text boxes under the “Instance Settings” tab on the left of the window.
Clients can apply for a Twitter Developer Account to obtain these credentials here: https://developer.twitter.com/en/apply-for-access
Commands
twitter-get-users
This command executes a search for users given a specified query. It will then return the results of the search in markdown format in the war room. This command uses Tweepy’s API to authenticate using OAuth 1.0 and then to perform the search function.
Arguments
name Required
The name of accounts to search; Twitter will return accounts with similar names to the one enetered in this argument
page
The search page to retrieve results from
count
The maximum number of potential users to retrieve per page. The maximum value is 20. The default value is 15.
include_entities
The entities node will not be displayed when set to false. The default value is false.
Underlying design:
Makes an API call to Twitter API v1.1 GET users/search, which provides relevance-based search results of public user accounts. This search is performed through Tweepy using the api call API.search_users. The results are returned in JSON format. The JSON results will then be neatly displayed in the War Room in Markdown format.
Example
!twitter-get-users name=”Palo Alto Networks” page=”1” count=”5” include_entities=”True”
Returns user accounts with names matching or similar to “Palo Alto Networks” located on page 1 of Twitter’s search results, and a maximum of 5 accounts will be displayed.
twitter-get-user-info
This command returns detailed account information about specified accounts.
Arguments
usernnames Required
The username of a given account to search for additional information.
Underlying design:
Makes an API call to Twitter API v2 GET /2/users/ which provides information about a specified user. The information provided includes the user’s description, entities, date of creation, id, location, name, pinned tweet id, profile image url, protected status, public metrics, url, username, and verified status.
Example
!twitter-get-user-info usernames=”PaloAltoNtwks”
Returns the description, entities, date of creation, id, location, name, pinned tweet id, profile image url, protected status, public metrics, url, username, and verified status of the account whose username is “PaloAltoNtwks”.
twitter-get-tweets
This command executes a search for tweets given a specified query. It will then return the results of the search in markdown format in the war room.
Arguments
q Required
The tweet content to search; Twitter will return tweets containing strings matching or similar to the one entered in this argument.
geocode
Returns tweets by users located within a specified radius of a specified latitude/longitude.
lang
Only displays tweets of the specified language, given in ISO 639-1 code.
result_type
Specifies which type of search results the user would like to display. Recent: Returns only the most recent results. Popular: Returns only the most popular results Mixed: Returns a mix of both recent and popular results.
count
The number of tweets to return per page. Max: 100
include_entities
The entities node will not be displayed when set to false. The default value is true.
from_user
The name of the user to search tweets by. All tweets returned will only have been made from the specified account.
to_user
The name of the user to search replies by. All tweets returned will only have been made in reply to the specified account.
Underlying design:
Makes an API call to Twitter API v1.1 search tweets, (https://api.twitter.com/1.1/search/tweets.json) which provides relevance-based search results of public tweets. The results are returned in JSON format. The JSON results will then be neatly displayed in the War Room in Markdown format.
Example
!twitter-get-tweets content=”xsoar” geocode=”28.738659 -111.193820 10mi” lang=”ru” result_type=”recent” count=”10” include_entities=”True”
Returns the 10 most recent tweets (in the russian language) containing the string “xsoar” that are located within 10 miles of 28.738659 -111.193820.
Configuration parameters
apikey— API Key (required)apikey_secret— API Key Secret (required)access_token— Access Token (required)access_token_secret— Access Token Secret (required)bearer_token— Bearer Token (required)
Commands (3)
-
twitter-get-tweetsDeprecatedSearch for tweets on Twitter.
-
twitter-get-user-infoDeprecatedLookup users by name to display information about them. Search multiple users simultaneously by separating them by commas. Ex: "name="user1,user2,user3"
-
twitter-get-usersDeprecatedSearch for public users on Twitter
commonfields: id: Twitter version: -1 name: Twitter display: Twitter (Deprecated) category: Utilities provider: X Corp description: 'Deprecated. Use Twitter v2 instead.' configuration: - display: API Key name: apikey type: 4 required: true - display: API Key Secret name: apikey_secret type: 4 required: true - display: Access Token name: access_token type: 4 required: true - display: Access Token Secret name: access_token_secret type: 4 required: true - display: Bearer Token name: bearer_token type: 4 required: true script: script: '-' type: python commands: - name: twitter-get-users arguments: - name: name required: true description: The string to search for accounts with similar names - name: count description: 'Number of accounts to return. Note: The max is 20.' defaultValue: "15" - name: page description: Page to look for search results on defaultValue: "1" outputs: - contextPath: TwitterSOARx description: Results of the twitter-get-users command type: string description: Search for public users on Twitter deprecated: true - name: twitter-get-user-info arguments: - name: usernames description: 'The twitter usernames to search' required: true outputs: - contextPath: TwitterSOARx description: Results of the twitter-get-user-info command type: string description: 'Lookup users by name to display information about them. Search multiple users simultaneously by separating them by commas. Ex: "name="user1,user2,user3"' deprecated: true - name: twitter-get-tweets arguments: - name: q required: true description: The word or string of words to search for in tweets. - name: result_type description: Recent, Popular, Mixed - name: geocode description: 'GPS Coordinates: Latitude,Longitude,RadiusMi/KM. Ex: geocode="23.453987,-35.726374,100mi"' - name: lang description: 'The language code of tweets to search for. List of supported languages: https://developer.twitter.com/en/docs/twitter-for-websites/supported-languages' - name: count description: The number of tweets to return. The max is 100. - name: include_entities description: Display entities (True/False), Defaults to True defaultValue: "True" - name: from_user description: 'Search tweets from a given user. Ex: "from_user=PaloAltoNtwks" returns only tweets from Palo Alto Networks.' - name: to_user description: 'Search tweets to a given user. Ex: "to_user=PaloAltoNtwks" returns only tweets in reply to Palo Alto Networks.' outputs: - contextPath: TwitterSOARx description: Results of the twitter-get-tweets command type: string description: Search for tweets on Twitter. deprecated: true dockerimage: demisto/tweepy:1.0.0.23810 subtype: python3 fromversion: 6.0.0 tests: - No tests (deprecated) deprecated: true