FrontlineSMS

FrontlineSMS let users send, receive and manage SMS over a mobile network.

Hi!

Just a short sharing of info on how to connect frontlineSMS to post to a twitter account.

------------------------
1. Get "cURL" (http://curl.haxx.se/download/curl-7.19.5-win32-nossl-sspi.zip).
2. Open the .zip archive and copy the "curl.exe" to "C:\curl.exe".
3. Start frontlineSMS
4. Add (or Edit) a Keyword and choose "External Command"
5. Type this in the command box:

C:\curl.exe -u twittername:twitterpassword  -d "status=${message_content}" http://twitter.com/statuses/update.xml

twittername / twitterpassword is your name and password on twitter

6. Test by SMS:ing the keyword and a message. the message content will show up in your twitter feed.


Tags: REST, twitter

Views: 113

Reply to This

Replies to This Discussion

Hi Mattias,

Thanks for the HOWTO - very neat!

Cheers,

Alex

Twitter has disabled basic auth. If you can call a PHP script from your FLSMS instance, you can use oAuth with PHP. Check the docs in Twitter to get the tokens, key and secret for your account.

 

This is what I'm using. It will require a direct connection to the Internet. If you want to bridge to Twitter over SMS you need to add a "forward" action to one of you keywords, as shown here


The oAuth library is here


Pablo

 

<?php
require_once 'TwitterOAuth.php';

define("CONSUMER_KEY", "my key");
define("CONSUMER_SECRET", "my secret");
define("OAUTH_TOKEN", "oAuth token");
define("OAUTH_SECRET", "oAuth secret");

//Get the message from the command
$message=$argv[1];

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$connection->format = 'xml';
$content = $connection->get('account/verify_credentials');

//Show credential verification output
//echo $content;

//Sanitize
$message = preg_replace('/[^-a-zA-Z0-9_ ]/', '', $message);
echo $message;

//Post to Twitter
$connection->post('statuses/update', array('status' => $message));
Thanks for the update, Pablo ! ;-)

RSS

© 2014   Created by FrontlineSMS Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service