Tweets from todo4teams


https://pbs.twimg.com/profile_images/2284174758/v65oai7fxn47qv9nectx.pngThis tutorial will show how to connect todo4teams and Twitter. We will use a todo4teams form to edit tweets and to post them to a Twitter profile.

We could also create a workflow to check if other Twitter users have sent us tweets and to filter and classify them to see if they need a reaction.

Why does it make sense to connect your ticketing system to social media?

Here are some good reasons:

  • Your can install a social media team with the highest  standard of availability and constant workforce just like for any other service fields.
  • You don't have to give the Twitter password to your teams members and control access to the social media functions by group assignments/permisisons in todo4teams.
  • There is no need to monitor the social media all the time if todo4teams can do this for you. It will react on events creating tickets so this well learned workflow is used.
  • No media hopping: Agents can solve email cases, sms, internal request and social media events with the same tool.

Before we can start tweeting we have to check for some prerequisites. We need...

  • a Twitter account (a personal account for testing or a corporate account)
  • an access token to connect to Twitter using the API. Please see this page to see how to create a token.
    This requires a few steps but it's fairly easy. The process end up presenting an access token and a token secret which we will be used in our script code later. Please make sure that your token has sufficient permissions for your purposes: If you want so tweet you need the access level "read, write and direct message".
    https://dev.twitter.com/sites/default/files/images_documentation/dtc04.png
  • At the end you have four values to keep: api key, api secret, access token and access token secret.
  • Last we need the Java library twitter4j installed in your todo4teams appliance. Pleas ask us to check this.

Now first create a new todo4teams form to edit your tweets. It should at least contain a text field for the tweet itself and optionally more fields for internal comments etc.:

twitter-form.png

Insert the following code in the forms end action script pane. Replace the tokens and secrets with the ones you got from dev.twitter.com:

// create a 'twitter factory':
var tf = new Packages.twitter4j.TwitterFactory();
// create a twitter object:
var twitter = tf.getInstance();
// set your credentials to access the Twitter API:
var api_token = '???????????'; // your api token
var api_secret = '????????????'; // your api token secret
var oauth_token = '???????'; // access token
var oauth_token_secret = '??????'; // access token secret
// create the access token object:
var a = new Packages.twitter4j.auth.AccessToken(oauth_token, oauth_token_secret);
twitter.setOAuthConsumer(api_token, api_secret);
// authenticate to Twitter:
twitter.setOAuthAccessToken(a);
// get the tweet text from the todo4teams form:
var tweet = helper.getMetaDataFromTaskByName("Twitter").getValueByFieldName("Tweet");
// tweet it:
twitter.updateStatus(tweet);

Happy tweeting!