Twitter vs Ethercard

Hi everybody

This is my code

// Twitter client sketch for ENC28J60 based Ethernet Shield. Uses supertweet.net
// as an OAuth authentication proxy. Step by step instructions:
// 
//  1. Create an account on www.supertweet.net by logging with your twitter
//     credentials.
//  2. You'll be redirected to twitter to allow supertweet to post for you
//     on twitter.
//  3. Back on supertweet, set a password (different than your twitter one) and
//     activate your account clicking on "Make Active" link in from the table.
//  4. Wait for supertweet email to confirm your email address - won't work
//     otherwise.
//  5. Encode "un:pw" in base64: "un" being your twitter username and "pw" the
//     password you just set for supertweet.net. You can use this tool:
//        http://tuxgraphics.org/~guido/javascript/base64-javascript.html
//  6. Paste the result as the KEY string in the code bellow.
//
// Contributed by Inouk Bourgon <contact@inouk.imap.cc>
//     http://opensource.org/licenses/mit-license.php
 
#include <EtherCard.h>

// supertweet.net username:password in base64
#define KEY   "ZXNhZmVzZW4xOjEyMzQ1Ng=="
#define API_URL "/1.1/statuses/update.json"

// ethernet interface mac address, must be unique on the LAN
byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

char website[] PROGMEM = "api.supertweet.net";


byte Ethernet::buffer[700];
Stash stash;
uint8_t runTime;

static void sendToTwitter () {
	// generate two fake values as payload - by using a separate stash,
	// we can determine the size of the generated message ahead of time
	byte sd = stash.create();
	stash.println("status=@inoukb my #Arduino tweets :-)");
	stash.save();
	  
	// generate the header with payload - note that the stash size is used,
	// and that a "stash descriptor" is passed in as argument using "$H"
	Stash::prepare(PSTR(API_URL),website, PSTR(KEY), stash.size(), sd);
	
	// send the packet - this also releases all stash buffers once done
	ether.tcpSend();
}

void setup () {
  Serial.begin(9600);
  Serial.println("\n[webClient]");

  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) 
    Serial.println( "Failed to access Ethernet controller");
  if (!ether.dhcpSetup())
    Serial.println("DHCP failed");

  ether.printIp("IP:  ", ether.myip);
  ether.printIp("GW:  ", ether.gwip);  
  ether.printIp("DNS: ", ether.dnsip);  

  if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
    
  ether.printIp("SRV: ", ether.hisip);

  sendToTwitter();
}

void loop () {
  ether.packetLoop(ether.packetReceive());
  
}

When i execute it, i look the arduino conects to the website

[webClient]
IP: 192.168.0.13
GW: 192.168.0.1
DNS: 200.118.2.88
SRV: 66.180.175.246

but i dont see any tweets. Im using a valid key but nothing is happening. The tweeter is esafesen1 and the pass is 123456. I don't now what is happening. Please can you help me? Thanks a lot!

I have the same issue. I added a line to see if the Tweet was sent successfully

sendToTwitter();
Serial.println("\nTweet Sent Successfully");

And every time it returns that it was.

However, still no tweets actually posted.

Any leads to solving this ?

thx, Netnut

Hi guys,

as supertweet.net seems to be down since 01.01.2014 is there any alternative for the Ethercard Library??

I don't think so. The standard ethernet library does not support SSL connections that Twitter requires to log in directly. You can't use SuperTweet because of this:

Important Notice: Effective January 24, 2014 Twitter has suspended the SuperTweet.net API.

Your application was suspended from interacting with the Twitter API because it violates our API Terms of Service (https://dev.twitter.com/terms/api-terms), specifically section I.4.A:

You will not attempt or encourage others to sell, rent, lease, sublicense, redistribute, or syndicate access to the Twitter API or Twitter Content to any third party without prior written approval from Twitter.

This means any intermediate way to interact with the Twitter API without written approval of Twitter is a violation of the Twitter terms of service.

ok so this means we are no longer able to use the arduino with twitter!? Or is there any workaround? I´m really not in this topic yet, but I want the arduino to send messages...

Take a look at the Twitter Terms of Service.
https://dev.twitter.com/terms/api-terms
It may not be a violation of the terms of service if you developed an interface to the Twitter API that only you could access, but I'm not sure. There is a bunch of legal language there that may prevent even that access.

I am using this and it is working: http://arduino-tweet.appspot.com/

snowwinter:
I am using this and it is working: http://arduino-tweet.appspot.com/

This appears to do the same as SuperTweet, so it would probably be in violation of the Twitter API Terms of Service also. I see no notice that they have written permission from Twitter to do this. If they don't have written permission, then it may work for a while until Twitter catches them at it, then they will have the same notice on their site as the one above.