Twitter - Get Friends

Declaration

<AMTWITTER ACTIVITY="get_friends" RESULTDATASET="text" SCREENNAME="text" ACCESSTOKEN="text" SECRETTOKEN="text"><Parameter Name="text (options)" Value="text" /></AMTWITTER>

See Also

Twitter - Delete Status | Twitter - Follow User | Twitter - Get Direct Messages | Twitter - Get Followers | Twitter - Get Friends | Twitter - Get Mentions | Twitter - Get Status | Twitter - Get Timeline | Twitter - Search | Twitter - Send Direct Messages | Twitter - Stop Following User | Twitter - Update Status

Description

Returns the (latest 100) given user's friends and populates a dataset with the results.

IMPORTANT: Use of this activity requires a valid Twitter account.

Practical Usage

See Description

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Create and populate dataset with user information

Text

Yes

(Empty)

RESULTDATASET="theDataset"

The name of the dataset to create and populate with specific information about the  followers that should be retrieved. More on the dataset that this activity creates can be found under Notes below.  

Authentication Properties

Property

Type

Required

Default

Markup

Description

Default Keys

 

 

 

 

If enabled, specifies that the default consumer/secret key combination used to authorize AutoMate access to Twitter API will be used. This also determines the text status that appears via Twitter application. Selecting this option would show AutoMate as the default application used to perform status updates. This is a visual mode parameter used only during design time, therefore, contains no markup. If this parameter is enabled, the Custom Keys parameter is ignored. It is enabled by default.

Custom Keys

 

 

 

 

If enabled, specifies that a custom consumer/secret key combination should be entered. This also determines the text status that appears via Twitter application. Selecting this option would show the specified application name as the one used to perform status updates. This is a visual mode parameter used only during design time, therefore, contains no markup. If this parameter is enabled, the Default Keys parameter is ignored.

Consumer Key

Text

No

(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. More information about OAuth authentication can be found below under Notes.  

Consumer Secret

Text

No

(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. More information about OAuth authentication can be found below under Notes.

Get PIN

 

 

 

 

You must initially register AutoMate (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 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. 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. More information about OAuth authentication can be found below under Notes.    

Pin

 

 

 

 

The pin in which to authorize AutoMate to allow it to use the Twitter API. This is a visual mode parameter used only during design time, therefore, contains no markup.

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. This is a visual mode parameter used only during design time, therefore, contains no markup.

Enable SSL

Yes/No

No

(Empty)

ENABLESSL="yes"

If set to YES, SSL is enabled. This parameter is set to NO 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 Notes.  

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 Notes.  

Parameters Properties

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

Property

Type

Required

Default

Markup

Description

Name

Text

No

(Empty)

a)Name="page"

The parameter name.

Value

Number

No

(Empty)

a)Value="3"

The value.

Proxy Properties

NOTE: Only HTTP proxy os supported.

Property

Type

Required

Default

Markup

Description

Proxy Host

Text

No

(Empty)

PROXYSERVER="host.domain.com"

The host name (i.e. server.domain.com) or IP address  (i.e. xxx.xxx.xxx.xxx) of the proxy server.

Proxy Port

Number

No

(Empty)

PROXYPORT="300"

The port that should be used to connect.

Proxy Username

Text

No

(Empty)

PROXYUSERNAME="user"

The user name that should be used to authenticate when connecting through the proxy server.

Proxy Password

Text

No

(Empty)

PROXYPASSWORD="encrypted"

The password that should be used to authenticate when connecting through the proxy server.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab allows you to select/omit specific errors that should cause a particular step to fail.

More on Error Causes properties

On Error Properties

The On Error tab allows you to determine what the task should do if a particular step encounters an error.

More about On Error properties

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.UserName

Text

The user name of the user.

theDataset.ScreenName

Text

Display name for the user. (Examples: tweetybird, dougw)

theDataset.ID

Number

The user's unique ID. (Examples: 1145445329 (status), 14198354 (user))

theDataset.Status

Text

Escaped and HTML encoded status body. (Examples: I am eating oatmeal, The first tag is always <html>)

theDataset.Description

Text

160 characters or less of text that describes a user.

theDataset.Friends

Number

Number of users a user is following. (Examples: 0, 221)

theDataset.Followers

Number

The number of followers a user has. (Examples: 0, 4510)

theDataset.Statuses

Number

The total number of status updates performed by a user, excluding direct messages sent. (Examples: 0, 9423)

theDataset.Favorites

Number

The number of statuses a user has marked as favorite. (Examples: 0, 4510)

theDataset.Location

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.IsProtected

Date

The timestamp of element creation, either status or user. (Example: Sat Jan 24 22:14:29 +0000 2009)

theDataset.IsGeoEnabled

True/False

Whether an individual user has enabled geotagging support on his or her account (Examples: true, false)

theDataset.ReceiveNotifications

True/False

Boolean indicating if a user is receiving device updates for a given user. (Examples: empty (Default), true, false)

theDataset.Language

Text

The language a user has chosen on Twitter.com for his or her account (Examples: en, fr)

theDataset.TimeZone

Text

The user's time zone (Examples: Central Time (US & Canada) (Default), Sydney)

theDataset.Website

Text

The user's homepage (Examples: empty, http://downforeveryoneorjustme.com)

theDataset.ProfileImageLocation

Text

The location to a user's avatar file. (Examples:  http://static.twitter.com/images/default_profile_normal.png)

Parameters

Name

Type

Return Value

user-id

Number

The user's unique ID.

screen-name

Text

Display name for the user.

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 the Insert expression/variable button or pressing F2.

More on variables
More on expressions

More on the Expression Builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Sample 1 - Get information about friend with screen name "Superman". Store user information into AutoMate dataset "myDataset.

 

<AMTWITTER ACTIVITY="get_friends" RESULTDATASET="theDataset" SCREENNAME="ankurkumarpatel" ACCESSTOKEN="138893066-pcQPBQlFnI8exepSZPaQcnljQJNg4tB6mUfGAywz" SECRETTOKEN="pL1IdTedxHU6JFd6HHRlkncy98R5PQLwKyrESGGM"><Parameter Name="screen_name" Value="Superman" /></AMTWITTER>

 

 

Sample 2 - Get information about all friends. Store user information into AutoMate dataset "myDataset". Loop the dataset and display the following information about each user in a message box:

  1. ID

  2. Language

  3. Time Zone

 

<AMTWITTER ACTIVITY="get_friends" RESULTDATASET="theDataset" SCREENNAME="ankurkumarpatel" ACCESSTOKEN="138893066-pcQPBQlFnI8exepSZPaQcnljQJNg4tB6mUfGAywz" SECRETTOKEN="pL1IdTedxHU6JFd6HHRlkncy98R5PQLwKyrESGGM" />

<AMLOOP TYPE="DATASET" DATASET="theDataset">

     <AMSHOWDIALOG>ID = %theDataset.ID%

Language = %theDataset.Language%

Time Zone = %theDataset.TimeZone%</AMSHOWDIALOG>

</AMLOOP>

 

↑ Top