SMS Notifications

So lets say that I have a script that can send SMS messages throgh google voice, and I want to setup that as a notification system. I am looking for some help with this, as I am not too familier with the way that Elgg works on the back end, I only know how to make it fast :) I have made a script that uses Curl to access and send messages through a Google Voice account, and I think that this could be a great system to have for notifications of site actions, and RSS feed updates. All I want for now is to have the ability to send SMS messages to a number that someone sets up on the notifications page or somewhere else, and as far as that goes, I am lost. Let me know what you are thinking would work for this, and if you think that I am crazy for trying! Thanks

  • and this

    http://labs.google.co.in/smschannels/browse

    It wud be such a nice utility :)

    HaPPy ElGGinG :)

    Do GooD :)

  • You know what, my friend and I have been discussing about this over phone. And perhaps there is someone he knows who can actually achieve this ...

  • Jax, googlr sms channels are available in India only. You can see an integration of Elgg with google channels we done at http://m4medicine.com.

    Regards, Team Webgalli

  • @WG mathi India mathi :) hehehe

    othiri perundallo... oopss.. We have many from India... may be someone can bundle it up and post here... you can as you already have done it and help your fellow Indian friends :)

     

    HaPPy ElGGinG :)

    Do GooD :)

  • I can already send messages with my php script through Google Voice, and it allows messages to any mobile phone on any network, not needing to maintain any email to sms gateway addresses. I can simply post data in the script, run it, and it sends a message to my phone. The thing that I don't understand is how to get elgg to call that script and post notification data to it while refrencing a number they have in their account. If anyone is willing to assist with that part, the rest is easy.

  • I would be curious to see your working CURL'ed script which works by itself to determiine how Elgg can call that script for notifications ;-)

  • I have no idea if this will post right, if not I am going to delete this and try again, or post a link... There is also a Beta Dial-a-number feature, that I am not sure of its purpose... yet.

     

    <?php
    define('GOOGLE_ACCOUNT','YourAccountLogin');
    define('GOOGLE_PASSWORD','YourAccountPass');
    function query($data=array(),$fields=array()){
        foreach($data as $k=>$v)
            $fields[]=$k.'='.urlencode(stripslashes($v));
        return implode('&',$fields);
    }
    function googleapi($url,$post=null){
        global $auth;
        $ch=curl_init();
        curl_setopt($ch,CURLOPT_URL,$url);
        if(is_array($post)){
            curl_setopt($ch,CURLOPT_POST,true);
            curl_setopt($ch,CURLOPT_POSTFIELDS,query($post));
        }
        if($auth)
            curl_setopt($ch,CURLOPT_HTTPHEADER,array('Authorization: GoogleLogin auth='.$auth));
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
        curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
        curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
        $data=curl_exec($ch) or curl_error($ch);
        curl_close($ch);
        return $data;
    }
    $auth=googleapi('https://www.google.com/accounts/ClientLogin',array(
                            'accountType'=>'GOOGLE',
                            'Email'=>GOOGLE_ACCOUNT,
                            'Passwd'=>GOOGLE_PASSWORD,
                            'service'=>'grandcentral',
                            'source'=>'googlevoice.php'));
    if(preg_match('/Error=([A-z]+)/',$auth,$error))
        die($error[1]);
    if(preg_match('/Auth=([A-z0-9_-]+)/',$auth,$auth))
        $auth=$auth[1];
    preg_match("/'_rnr_se'\: '([^']+)'/",googleapi('https://www.google.com/voice/'),$rnr);
    $rnr=$rnr[1];
    function call($them,$me){
        global $rnr;
        return googleapi('https://www.google.com/voice/call/connect/',array(
            'outgoingNumber'=>$them,
            'forwardingNumber'=>$me,
            'subscriberNumber'=>'undefined',
            'phoneType'=>2,
            'remember'=>'0',
            '_rnr_se'=>$rnr)
        );
    }
    function hangup(){
        global $rnr;
        return googleapi('https://www.google.com/voice/call/cancel/',array(
            'outgoingNumber'=>'undefined',
            'forwardingNumber'=>'undefined',
            'cancelType'=>'C2C',
            '_rnr_se'=>$rnr)
        );
    }
    function sms($them,$text){
        global $rnr;
        return googleapi('https://www.google.com/voice/sms/send/',array(
            'id'=>'',
            'phoneNumber'=>$them,
            'text'=>$text,
            '_rnr_se'=>$rnr)
        );
    }
    // Place a call: call(Their Number,Your Number);
    // call(9135555555,3165555555);

    // hangup();

    // Send an SMS: sms(Their Number,Message);
    sms(7202138616,'Hello! I am testing the SMS Script!');
    ?>

  • Oki I see the code.. can you PM me some pointers, URLs for the Google SMS thingy ? So that I can get my Account and so on  I'm out of touch ;-( BTW some months ago there was some ELggster from germany who had the similar SMS question.. wish I could remember my answer.. because it worked for him... lolz ;-X How comfy are you with Elgg internal (key question) ?

  • I would go to www.google.com/voice I am not sure where you are located, but the script will only work for US numbers, as google voice no longer does International SMS, Hope they bring it back soon. This was not a concern for me, as the site is pretty much local for me, might be of issue to others, until they bring back International Text. I can tear through any code, but I have no knowledge of Elgg as far as how it runs, that I am scared to even try. This is a project that is outside of my level of knowledge.