Difference between revisions of "TwitterSocialAdapter"

From GreenVulcano Wiki
Jump to: navigation, search
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Twitter adapter is an implementation of the Social Adapter dedicated to [http://twitter.com Twitter] platform. It can be called as  
 
Twitter adapter is an implementation of the Social Adapter dedicated to [http://twitter.com Twitter] platform. It can be called as  
specified into GVSocialAdapter-Configuration specifying a method name to call, or with some custom function reflecting Twitter ones.
+
specified into [[GVSocialAdapter-Configuration]] specifying a method name to call, or with some custom function reflecting Twitter ones.
  
 
Please refer to [[GVSocialAdapter-Configuration]] to see the generic call.
 
Please refer to [[GVSocialAdapter-Configuration]] to see the generic call.
  
The other calls are the following:
+
The VCL operations usable in the workflows are the following:
 +
{|class="gvtable" style="width: 80%"
 +
! style="width: 5%" | !! style="width: 20%" | Plug-in !! style="width: 75%" | Use this for ...
 +
|-
 +
| [[File:Tweet.png | 20px]] || [[twitter-update-status]]  || tweet
 +
|-
 +
| [[File:Retweet.png | 20px]] || [[twitter-retweet-status]] || retweet
 +
|-
 +
| [[File:Follow.png | 20px]] || [[twitter-enable-notification]] || follow
 +
|-
 +
| [[File:Unfollow.png | 20px]] || [[twitter-disable-notification]] || unfollow
 +
|-
 +
| [[File:Follower.png | 20px]] || [[twitter-get-followers-ids]] || get followers
 +
|-
 +
| [[File:AddUser.png | 20px]] || [[twitter-get-friends-ids]] || get friends
 +
|-
 +
| [[File:Message.png | 20px]] || [[twitter-send-direct-message]] || send direct tweet
 +
|}
 +
<div class="version_ge3.4">
 +
{|class="gvtable" style="width: 80%"
 +
! style="width: 5%" | !! style="width: 20%" | Plug-in !! style="width: 75%" | Use this for ...
 +
|-
 +
| [[File:Tweet.png | 20px]] || [[twitter-get-user-timeline]]  || get user timeline
 +
|-
 +
| [[File:Tweet.png | 20px]] || [[twitter-search]]  || search status updates
 +
|}
 +
</div>
  
* ''updateStatus(java.lang.String status)'' sends a tweet.
+
Its attributes are:
The status is the message to tweet.
+
{|class="gvtable"
* ''retweetStatus(long statusId)'' retweets a tweet identified by its Id.
+
! Attribute !! Type !! Description
* ''sendDirectMessage(long userId, java.lang.String text)'' sends a message directly to a user.
+
|-
* ''enableNotification(long userId)'' follows a Twitter account.
+
| type || fixed || This attribute must assume the value '''social-adapter'''.
* ''disableNotification(long userId)'' unfollows a Twitter account.
+
|-
* ''getFollowersIDs(long userId, long cursor)'' gets the list of the account's followers beginning from the ''cursor'' position.
+
| class || fixed || This attribute must assume the value '''it.greenvulcano.gvesb.social.twitter.TwitterSocialAdapter'''.
* ''getFriendsIDs(long cursor)'' gets the list of the account's friends, that is the followed accounts, beginning from the ''cursor'' position.
+
|-
The last two calls return a long[] value setting it into the [[GVBuffer]].
+
| social || fixed || This attribute must assume the value '''twitter'''.
 +
|}
 +
 
 +
Might contain the following sub-elements:
 +
* [[Description]]
 +
* [[#Account | Account]]
 +
* [[Proxy]]
 +
 
 +
===Account===
 +
 
 +
Defines the properties of a Twitter application account.
 +
 
 +
Its attributes are:
 +
{|class="gvtable"
 +
! Attribute !! Type !! Description
 +
|-
 +
| name || required || Account name '''(avoid spaces in @name value)'''.
 +
|-
 +
| consumer_key || required || Account consumer key.
 +
|-
 +
| consumer_secret || required || Account consumer secret.
 +
|-
 +
| twitteruserid || required || Account consumer twitter id.
 +
|}
 +
 
 +
For every Account, the information must be completed defining the following couple of properties into '''TwitterAccounts.properties''' file:
 +
ACCOUNT_NAME.oauth_access_token=...
 +
ACCOUNT_NAME.oauth_access_token_secret=... 
 +
where '''ACCOUNT_NAME''' is '''Account/@name''' value.
 +
 
 +
To get the required token/key/secret follow the instructions on [https://dev.twitter.com/docs/auth/tokens-devtwittercom tokens-devtwittercom]

Latest revision as of 12:57, 14 May 2014

Twitter adapter is an implementation of the Social Adapter dedicated to Twitter platform. It can be called as specified into GVSocialAdapter-Configuration specifying a method name to call, or with some custom function reflecting Twitter ones.

Please refer to GVSocialAdapter-Configuration to see the generic call.

The VCL operations usable in the workflows are the following:

Plug-in Use this for ...
Tweet.png twitter-update-status tweet
Retweet.png twitter-retweet-status retweet
Follow.png twitter-enable-notification follow
Unfollow.png twitter-disable-notification unfollow
Follower.png twitter-get-followers-ids get followers
AddUser.png twitter-get-friends-ids get friends
Message.png twitter-send-direct-message send direct tweet
Plug-in Use this for ...
Tweet.png twitter-get-user-timeline get user timeline
Tweet.png twitter-search search status updates

Its attributes are:

Attribute Type Description
type fixed This attribute must assume the value social-adapter.
class fixed This attribute must assume the value it.greenvulcano.gvesb.social.twitter.TwitterSocialAdapter.
social fixed This attribute must assume the value twitter.

Might contain the following sub-elements:

Account

Defines the properties of a Twitter application account.

Its attributes are:

Attribute Type Description
name required Account name (avoid spaces in @name value).
consumer_key required Account consumer key.
consumer_secret required Account consumer secret.
twitteruserid required Account consumer twitter id.

For every Account, the information must be completed defining the following couple of properties into TwitterAccounts.properties file:

ACCOUNT_NAME.oauth_access_token=...
ACCOUNT_NAME.oauth_access_token_secret=...   

where ACCOUNT_NAME is Account/@name value.

To get the required token/key/secret follow the instructions on tokens-devtwittercom