If your product, device, machine, gadget or thing can connect to the Internet, it can use dweet.io to easily publish and subscribe to data.
dweet.io doesn't require any setup or sign-up— just publish and go. It's machine-to-machine (M2M) for the Internet Of Things (IOT) the way it was meant to be.
Check out a few of the things that are dweeting now.
Just replace my-thing-name with a unique name. That's it!
Any query parameters you add to the request will be added as key-value pairs to the content of the dweet. For example: https://dweet.io/dweet/for/my-thing-name?hello=world&foo=bar
You can also send any valid JSON data in the body of the request with a POST
.
Dweet.io will also respond to JSONP requests with a ?callback=
query parameter.
While we recommend using a secure https:// connection, dweet.io also supports un-secure http:// connections for devices that don't support SSL.
{
"this": "succeeded",
"by": "dweeting",
"the": "dweet",
"with": {
"thing": "my-thing-name",
"created": "2014-01-15T17:28:42.556Z",
"content": {
"hello": "world",
"foo": "bar"
}
}
}
{
"this": "succeeded",
"by": "getting",
"the": "dweets",
"with": [
{
"thing": "my-thing-name",
"created": "2014-01-15T18:41:17.166Z",
"content": {
"this": "is cool!"
}
},
{
"thing": "my-thing-name",
"created": "2014-01-15T18:41:01.583Z",
"content": {
"hello": "world",
"foo": "bar"
}
}
]
}
https://dweet.io/listen/for/dweets/from/my-thing-name
(Note, this won't work in a standard browser)
From a unix command line you can run the following command to see it working:
curl -i https://dweet.io/listen/for/dweets/from/my-thing-name
{"thing":"my-thing-name","created":"2014-02-17T01:10:21.901Z","content":{"foo":"bar"}}
A simple javascript expression to evaluate the data in a dweet and to return whether or not an alert should be sent. You can reference the actual data in the dweet as a javascript object, like dweet.my_field
or dweet["my_field"]
. If the javascript expression returns anything other than a "falsey" value (false, null, undefined, 0, etc.), an alert will be sent.
For example, alert me when a temperature becomes extreme:
dweet.temp <= 32 || dweet.temp >= 212
You can also create more complex, multi-state alerts by returning a string:
if(dweet.temp <= 32) return "frozen"; else if(dweet.temp >= 212) return "boiling";
Note that the javascript expression you provide for the condition is limited to 2000 characters and may not contain complex things like loops and some other javascript reserved words. However, things like Math
functions are supported.
You should normally URL-encode your condition, but you can also pass the condition in the body of a post message if it does not fit within the URL.