Scheduling Status Updates (?)

status
oauth
api

#1

I’m struggling to create this app that for the moment is only for my personal use on a single Twitter account (I only have one).

I’d like to schedule a small number of periodic tweets, about 3 a day.

I know there are a bunch of third-party applications that do this – Hootsuite, MangeFlitter, Buffer, TwitTimer, etc, etc…

And yet, in searching for answers about how to do this, Twitter staff’s official response seems to be “we don’t allow people to do this thing.” That many people are currently doing.

So what gives?

The big hurdle here is:

  • the API won’t schedule posts – I saw threads where it was mentioned that TweetDeck and the ad manager do this, but it’s not exposed in the API
  • the API prevents my app from posting for me if I’m not ACTIVELY sitting in front of my browser telling it to post, which defeats the purpose of scheduling

Is there anyone here who’s managed to make it work?

EDIT: Attempts to post without first having signed in at the browser result in a 220 error message after the active session expires. In this thread, a former staffer said that oAuth was a requirement for posting, which I thought meant that I had to be actively at the browser to authorize?

Then says I can find my own tokens in twitter’s apps admin – but those tokens are hard-coded and I’m still getting the error after the session with the oAuth tokens expires. How long can an oAuth session last? Can I store the oAuth tokens for a month?

Thanks!
Sam

p.s. I don’t think it’s really important here, but I’m working in ColdFusion. I installed the monkehTweets script and it works as expected, it just has very little documentation and in particular no documentation about this scheduling task.


#2

There’s no standard API for Tweet scheduling, correct. This functionality is available in the Ads API only.

I’m not sure what error you’re seeing there. You can call statuses/update on a schedule if you choose. However, in doing so, you must pay careful attention to the automation rules, and avoid substantially duplicative content, overuse of similar hashtags and URLs, posting unsolicited mentions to other users - all of which will be picked up by our antispam machine learning systems. On a low-volume scale with unique content that avoids those other issues, you should be able to build something like you’re describing.

Unfortunately I’m not familiar with ColdFusion or the script you’re using, so I’m unable to offer guidance there.


#3

Sorry Andy, I forgot to include the error code. I’m getting 220 after my session with oAuth tokens expires – I updated the question.

Thanks!
Sam


#4

Right - that’s referring to connecting to the API with OAuth. That’s not connected to your browser session / Twitter login status. You’d need to use the application consumer key and secret, and the user token and secret, that you generate on apps.twitter.com in order to post to the API.


#5

Okay, but as I said before, I AM using those key/secret from apps.twitter.com, and still getting that 220 “you are not authorized” message if I don’t have an active session in the browser.


#6

Ah OK that’s weird - what language are you implementing in? Are you able to share any code that demonstrates the issue? Are you able to use the same consumer key and secret to configure a twurl session and post to statuses/update?


#7

I’m using ColdFusion on Windows… I could provide some code… but monkehTweets is pretty verbose and I suspect it would be difficult to see what’s actually happening from any discrete section of this code… I should maybe unpack the monkehTweets interactions and start essentially from scratch on the http call and then if I still have the issue I could provide a better code sample.

I could maybe use Twurl, but I’d have to get it running on Windows first? It appears to be written for *nix distros?

I’ll knock on it some more and let you know.

Thanks, Andy!
Sam


#8

It’s written in Ruby so it should be portable. You could also try using Postman if you prefer. I keep meaning to getting around to putting together a tutorial on setting the right auth headers in Postman, it’s on my todo list though…


#9

In retrospect, now that I’m unpacking the original script, I suspect it was a case of storing the access token/secret pair in the session scope (which obviously expires), instead of storing it in a more long-term location… which I thought I had already addressed, but we’ll see. I might have goofed those edits.


#10

:crossed_fingers:


#11

Thanks, Andy!

Got it working and I’m pretty sure I won’t have any more of those session expiration issues – I disabled session handling in the app completely. But then when I got into the code it turns out that it was using a deprecated endpoint method for uploading media and all the code for that was a big mess I had to all but rewrite.

You don’t think they’re likely to spam-flag me for 3-4 tweets a day do you? No mentions, just periodic reminders of things I wrote and such. I do use the #funny hashtag pretty frequently because I’m a comedian and basically all my work is some kind of comedy. But in general, my impression is that cycling through about 9 different messages over the course of 3 days before repeating isn’t such a large volume it would be considered spam?

Thanks!


#12

I’m unable to say for sure, since the antispam tools are based on machine learning, but given the small volume you’re talking about I think it is unlikely to be flagged as problematic. I’m glad you got posting to the API working, at least!


#13

Okay, well that’s good to know anyway. That must also be why Facebook’s been flagging some of my stuff as spam lately too.

Thanks, Andy!