API Sample App: Sheet Tweetr

Published on 21 November 2017

The Developer Relations team at Smartsheet uses Twitter to tell the world about our activities and what we are involved with. Between sponsoring, hosting, or speaking at events and publishing sample applications that use Smartsheet’s API—we have a lot of announcements to make.

Unfortunately, individual announcements on Twitter don’t attract much attention amidst the veritable deluge of tweets. Even your most loyal followers may miss what you’re saying through all that noise. On top of that, we wanted to be able to stay focused on sponsoring, hosting and speaking rather than watching the clock for the “exact right time” to type something into the Twitter client.

Enter Sheet Tweetr.

What Does it Do?

Sheet Tweetr is a simple application that sends tweets from a sheet in Smartsheet. The app reads a sheet, checks each row to see when the tweet is scheduled to go out, and then posts the tweet when the time is right. The same tweet can go out multiple times depending on the frequency set by the user.

How Does it Work?

Sheet Tweetr contains several moving pieces and explaining how things work gets a little verbose. We’ll take a deeper dive under the hood in the next article. Instead, let’s follow the journey of a tweet in our sheet. Let’s assume I want to share Burrito Cat with the world. While it’s funny, it’s really only funny a few times, so I only want to share it once towards the end of the day (our time, PST).

*The row is split into two images.

Sheet Tweetr row for burrito cat tweet 1 Sheet Tweetr row for burrito cat tweet 2

My burrito cat tweet begins as a new row on the sheet. I give the tweet a Name, an optional (not required for Sheet Tweetr to run) field that helps a user organize the tweets on their sheet.  

Next, I add the Tweet content. The Tweet field is where the actual text for the tweet goes. This field supports hashtags, @ mentions, and even renders links as if you were tweeting directly on Twitter.

I include an Image with my tweet (the burrito cat, of course). Images are optional and attach to the tweet in their respective row. Images must adhere to the constraints laid out by Twitter, but Smartsheet supports jpg, gif, or png. The Image must be in the Image cell rather than attached to the entire row.

I set the Start and End date of my tweet. Start is the first date the tweet is eligible to be posted while End is the last date. When setting up a recurring tweet, start and end are used to define a range of time that the tweet can be posted. However, I only want to post burrito cat once.  

I define the Frequency and Frequency Type as 1 per day. Sheet Tweetr uses these fields to determine the appropriate length of time between each tweet. A user can set the frequency by hour, day, week, or month.

The LastRan field is left blank. LastRan is used by Sheet Tweetr to track the specific time that a past tweet was posted. A user should not make any changes to LastRan.

I set the First Tweet Time to 4:00 pm. Sheet Tweetr will post a tweet within an hour of the First Tweet Time on the Start date. Specifying the post time time only works on the specified Start date.

According to the row entered into the sheet, burrito cat should be tweeted at 4:00pm on November 10th, 2017. The result:

Sheet Tweetr posts Burrito Cat

Tweet Responsibly

Interested in learning more about Sheet Tweetr? The next article, A Deeper Dive into Sheet Tweetr, examines what is happening under the hood of the application. The Sheet Tweetr source code is available on the Smartsheet Samples GitHub. Whether you want to use Sheet Tweetr as is or hack it up to meet your needs, please help yourself!

The primary goal of Sheet Tweetr is to serve as a reference for building with the Smartsheet API and another, third party API, but we’re also “scratching our own itch” in the process. Sheet Tweetr has been live for nearly a month.

Your feedback or questions are welcome. Please contact DeveloperRelations@Smartsheet.com

comment

Comments