# Tutorial: Sending Tweets from Spark Core

**URL:** <https://community.particle.io/t/tutorial-sending-tweets-from-spark-core/2894>\
**Category:** Tutorials\
**Created:** [February 16, 2014, 10:19am UTC](https://community.particle.io/t/tutorial-sending-tweets-from-spark-core/2894 "2014-02-16T10:19:33Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![timb](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/timb/32/1913_2.png) [@timb](https://community.particle.io/u/timb)\
**Post date:** [February 24, 2014, 3:42am UTC](https://community.particle.io/t/tutorial-sending-tweets-from-spark-core/2894/7 "2014-02-24T03:42:38Z")

</div>

Okay guys, [**this code by SaraJo**](https://github.com/SaraJo/spark-tweets) works perfectly. The instructions are pretty simple.

1. [Go to this site and follow _Step 1_](http://arduino-tweet.appspot.com). Save the long string you get (OAuth Key), you’ll need this later!
2. Paste the code I’ve provided below into a new Sketch in the WebIDE.
3. At the top of the code you’ll see a line called `#define TOKEN "OAuth"`. Replace the word _OAuth_ with the long string you got in _Step 1_. (Be sure you keep the quotes around your OAuth string!)
4. At the very top of the code you’ll find a line called `char msg[] = "Hi, I'm a tweet from a Spark Core!";`. Replace that sentence with whatever you want to tweet!
5. That’s it! Flash the sketch to your Core and check your Twitter account!

Caveats: You can only send around _one tweet per minute_, so don’t run this code in the main loop!

If this works for you guys I’ll wrap it up into a neat little function.

Code:

```
// Message to Post
char msg[] = "Hi, I'm a tweet from a Spark Core!";

// OAuth Key
#define TOKEN "OAuth"

// Twitter Proxy
#define LIB_DOMAIN "arduino-tweet.appspot.com"

TCPClient client;

void setup()
{
    delay(1000);

    client.connect(LIB_DOMAIN, 80);
    client.println("POST /update HTTP/1.0");
    client.println("Host: " LIB_DOMAIN);
    client.print("Content-Length: ");
    client.println(strlen(msg)+strlen(TOKEN)+14);
    client.println();
    client.print("token=");
    client.print(TOKEN);
    client.print("&status=");
    client.println(msg);
}

void loop() {
    
}

```

---

_[View the full topic](https://community.particle.io/t/tutorial-sending-tweets-from-spark-core/2894)._
