Twitter - Get timeline

Declaration

<AMTWITTER ACTIVITY="get_timeline" CONSUMERKEY="text" CONSUMERSECRET="text (encrypted)" SCREENNAME="text" ACCESSTOKEN="text" SECRETTOKEN="text (encrypted)" ENABLESSL="YES/NO" PROXYTYPE="text (options)" PROXYSERVER="text" PROXYPORT="number" PROXYUSERNAME="text" PROXYPASSWORD="text (encrypted)" TYPE="text (options)" RESULTDATASET="text" /><PARAMETER NAME="text (options)" VALUE="text" /></AMTWITTER>

Related Topics   

Description

Returns the 20 most recent statuses of the specified type and populates a dataset with the results. A timeline is a Twitter term used to describe a collected stream of Tweets listed in real-time order. Timeline types include Friends, Home, Public or User timelines.

IMPORTANT: Automate Desktop's Twitter activities are performed using the Twitter REST API. Launching and managing Twitter through Automate Desktop requires a valid Twitter account.

Practical usage

See Description.

Parameters

Authentication

Property Type Required Default Markup Description
Type --- --- --- --- Specifies the type of authentication that should be used to establish a Twitter connection. The available options are:
  • Default keys - Specifies that the default consumer/secret key combination used to authorize Automate Desktop access to Twitter API will be used. This also determines the text status that appears by way of Twitter application. Selecting this option would show Automate Desktop as the default application used to perform status updates. If this parameter is selected, the Custom keys parameter is ignored.
  • Custom keys - specifies that a custom consumer/secret key combination should be entered. This also determines the text status that appears by way of Twitter application. Selecting this option would show the specified application name as the one used to perform status updates.  If this parameter is selected, the Default keys parameter is ignored.
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Consumer key Text Yes, if Type is set to Custom keys (Empty) CONSUMERKEY="text" The consumer key to authenticate with. To use the Twitter API, each client application you register will be provisioned a consumer key and secret. This parameter is available only if the Custom Keys parameter is enabled.
Consumer secret Text Yes, if Type is set to Custom keys (Empty) CONSUMERSECRET="encrypted" The consumer key secret to authenticate with. To use the Twitter API, each client application you register will be provisioned a consumer key and secret. This parameter is available only if the Custom Keys parameter is enabled.
Get PIN --- --- --- --- You must initially register Automate Desktop (or the desired application) to allow it to use the Twitter API. If you have not done so already, click the Get Pin button. This will open your Twitter account site. Follow the instructions and copy the provided pin. Thereafter, return to the Automate Desktop Twitter authentication properties dialog and paste it in the Pin text box. Click the Authenticate Pin button to produce a consumer key and secret, thus, completing the token exchange.
NOTE: This is a one-time process. Once authenticated, the information will be stored on your system. More information about OAuth authentication can be found below under OAuth Consumer Key/Secret Authentication.    
Pin --- --- --- --- The pin in which to authorize Automate Desktop to allow it to use the Twitter API.
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Authenticate Pin --- --- --- --- Click this button to authenticate the provided PIN. This is a visual mode parameter used only during design time, therefore, contains no markup.  
NOTE: This is a one-time process. Once authenticated, the information will be stored on your system.
Screen name Text Yes (Empty) SCREENNAME="Catwoman" The screen name of the authenticating user.
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Enable SSL Yes/No No (Empty) ENABLESSL="yes" If selected, SSL is enabled. This parameter is disabled by default.
Access token Text No (Empty) SECRETTOKEN="pL1IdTedxHU6JFd6HHRlknM" The Oauth Access Token. This allows OAuth applications to directly exchange Twitter user names and passwords for OAuth access tokens and secrets. More information can be found below under OAuth Consumer Key/Secret Authentication.      
Access token secret Text No (Empty) SECRETTOKEN="text" The Oauth Token Secret. This allows OAuth applications to directly exchange Twitter user names and passwords for OAuth access tokens and secrets. More information can be found below under OAuth Consumer Key/Secret Authentication.      

Proxy

Property Type Required Default Markup Description
Proxy type Text (options) Yes Default
  • PROXYTYPE="none"
  • PROXYTYPE="http"
The type of proxy required for connections that pass through a proxy server. The available options are:
  • System default (default) - Points to the default proxy used by the system.
  • None - No proxy authentication required.
  • HTTP - Proxy type is HTTP.
Use authentication --- No --- --- If enabled, specifies proxy authentication is required, enabling authentication-based parameters (disabled by default). It is active only if Proxy type is set to HTTP.
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Proxy server Text No (Empty) PROXYSERVER="proxy.host.com" The hostname (server.domain.com) or IP address (xxx.xxx.xxx.xxx) of the proxy server. This parameter is available only if Proxy type is set to HTTP.
Proxy username Text No (Empty) PROXYUSERNAME="username" The proxy username to authenticate with. This parameter is available only if Use authentication is enabled.
Proxy port Number No 808 PROXYPORT="8080" The port number to use to connect to the proxy server. This parameter is available only if Proxy type is set to HTTP. The default value is 808.
Proxy password Text No (Empty) PROXYPASSWORD="encrypted" The proxy password to authenticate with. This parameter is available only if Use Authentication is enabled.

General

Property Type Required Default Markup Description
Type Text (options) No Friends TYPE="public" The type of timeline in which to retrieve. The available options are:
  • Home (default) - Returns the 20 most recent statuses, including retweets if they exist, posted by the authenticating user and the users they follow. This is the same timeline seen by a user when they login to twitter.com.

  • User - Returns the 20 most recent statuses posted by the authenticating user.

Create and populate dataset with user information Text No (Empty) RESULTDATASET="theDataset" The name of the dataset to create and populate with specific information about the timeline that should be retrieved. For more information, see Datasets.  

Parameters

This activity allows you to set name/value parameters to filter results. The parameter names that this activity allows are listed below under Parameters.

Property Type Required Default Markup Description
Name Text No (Empty) NAME="page" The parameter name.
Value Number No (Empty) VALUE="3" The parameter value.

Description

Error Causes

On Error

Additional notes

OAuth consumer key/secret authentication

To use the Twitter API, the first thing you have to do is register a client application. Each client application you register will be provisioned a consumer key and secret. This key and secret scheme is similar to the public and private keys used in protocols such as ssh for those who are familiar. This key and secret will be used, in conjunction with an OAuth library in your programming language of choice, to sign every request you make to the API. It is through this signing process that Twitter trusts that the traffic that identifies itself is in fact you.

OAuth authentication is the process in which Users grant access to their Protected Resources without sharing their credentials with the Consumer. OAuth uses Tokens generated by the Service Provider instead of the User’s credentials in Protected Resources requests. The process uses two Token types:

Request Token

Used by the Consumer to ask the User to authorize access to the Protected Resources. The User-authorized Request Token is exchanged for an Access Token, MUST only be used once, and MUST NOT be used for any other purpose. It is RECOMMENDED that Request Tokens have a limited lifetime.

Access Token

Used by the Consumer to access the Protected Resources on behalf of the User. Access Tokens MAY limit access to certain Protected Resources, and MAY have a limited lifetime. Service Providers SHOULD allow Users to revoke Access Tokens. Only the Access Token SHALL be used to access the Protect Resources.

OAuth Authentication is done in three steps:

  1. The Consumer obtains an unauthorized Request Token.

  2. The User authorizes the Request Token.

  3. The Consumer exchanges the Request Token for an Access Token.

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name Type Return Value
theDataset.Created Date The user name of the user.
theDataset.ID Number A permanent unique id referencing an object, such as user or status. (Example: 1145445329 (status), 14198354 (user))
theDataset.InReplyToStatusID Number The unique id for the status a status replies to. (Examples: empty, 1047468972)
theDataset.InReplyToUserID Number 160 characters or less of text that describes a user.
theDataset.InReplyToScreenName True/False Number of users a user is following. (Examples: 0, 221)
theDataset.IsFavorited True/False The number of followers a user has. (Examples: 0, 4510)
theDataset.IsTruncated True/False Boolean indicating if a status required shortening.
theDataset.Source Number The number of statuses a user has marked as favorite. (Examples: 0, 4510)
theDataset.RetweetedStatus Text The user specified string representing where they are from. (Examples: empty (Default), California OR New York, NY, In The Woods, 27.893621,-82.243706 )
theDataset.Text Date The timestamp of element creation, either status or user. (Example: Sat Jan 24 22:14:29 +0000 2009)
theDataset.TwitterUser Text Whether an individual user has enabled geotagging support on his or her account (Examples: true, false)

Parameters

Home Timeline

Name Type Description
since_id Number The since_id passed in with a search query. (Example: 1480307926)
max_id Number The maximum status_id in a search result set. (Examples: 1047468972)
count Number The total amount of statuses to retrieve. (Example: count=5)
page Number The page number of a search result set (Example: 1)

User Timeline

Name Type Description
user_id Number A unique number Twitter assigns to a profile.
screen_name Text The screen name of the user. (Examples: tweetybird, dougw)
since_id Number The since_id passed in with a search query. (Example: 1480307926)
max_id Number The maximum status_id in a search result set. (Examples: 1047468972)
count Number The total amount of statuses to retrieve. (Example: count=5)

Variables and expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (Example: %myVariable% or %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking theInsert expression/variablebutton or pressingF2.

More on variables
More on expressions

More on the Expression Builder

Examples

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Example 1

A simple step that gets the timeline of type "user" and stores status information into Automate Desktop dataset named "theDataset."

Copy
<AMTWITTER ACTIVITY="get_timeline" TYPE="user" RESULTDATASET="theDataset" SCREENNAME="ronneylovely" ACCESSTOKEN="133348295-PORXRI8G89z6oQBklBYE8JN98VffugsPPAsnEKtw" SECRETTOKEN="BtemBbytOZERrkUBYFagHV1e5jju1APQ5cMo1GZMU" />

Example 2

Get timeline of type "public". Store status information into Automate Desktop dataset named "theDataset". Loop through the dataset named "theDataset" . Dataset is sorted in ascending alphabetical order on the "TwitterUser" column. Within each iteration, display the following information:

  • Twitter User Name

  • User Creation Date

  • User ID  

Copy
<AMTWITTER ACTIVITY="get_timeline" TYPE="public" RESULTDATASET="theDataset" SCREENNAME="ronneylovely" ACCESSTOKEN="133348295-Eg6hurc2YWpqdZrgbzsoXpWoQtT5D0vSn3UnhpME" SECRETTOKEN="lqNo7BuRHBeDfWAvSTsZg4B3UqQGXNAN9hynYCC5M" />
<AMLOOP ACTIVITY="dataset" DATASET="theDataset" />
<AMSHOWDIALOG>Twitter User Name = %theDataset.TwitterUser%User Creation Date = %theDataset.Created%User ID = %theDataset.ID%</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />