Google Voice Custom Call Widget

Create your own call widget in google voice. In the embed code look for the flashVars.

<param name="FlashVars" value="id={id}&amp;style=0" />

Take the id value ({id}) and fill in the array data below.
showCallerNumber is either 1 or 0 show number/ call anon which doesn’t show the number
callerNumber is the number that is calling you. so 1 + 10 digit number.
name is the name of the person calling you.

Now that you have all this information fill in the $postVars array and test out the script and receive your first call.

<?php

$url = 'https://clients4.google.com/voice/embed/webButtonConnect';
$postVars = array(
 'showCallerNumber' => '1',
 'callerNumber' => '1{10 diget phone number (don't forget to add the one in front)}',
 'buttonId' => 'button id',
 'name' => 'Name of the caller'
 );
$t = http_build_query($postVars);

 $ch = curl_init($url);
 curl_setopt($ch, CURLOPT_POST      ,1);
 curl_setopt($ch, CURLOPT_POSTFIELDS    ,$t);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1);
 curl_setopt($ch, CURLOPT_HEADER      ,0);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);
 $Rec_Data = curl_exec($ch);
 echo $Rec_Data;

?>
This entry was posted in PHP, Voice. Bookmark the permalink.

26 Responses to Google Voice Custom Call Widget

  1. Paul Smith says:

    Sorry to be dense, but the steps are:

    paste in your id from the Google Voice widget embed code, then…are we supposed to enter our Google Voice number in that $postvars section, or is that meant for someone entering it in the widget?

  2. Snipsta says:

    year sorry about that I am not very good at this stuff.

    showCallerNumber is if the caller wants to be anon. 0 would be anon, 1 will show his number.

    callerNumber is for the person wanting to call you.

    buttonId is the id in the google version of the call widget. so you must first create a google widget then in that source in the FlashVars there is an id value. take what you see in that value and put it in buttonId.

    name is the callers name.

  3. Snipsta says:

    ohh I also left out one problem with my script. the callerNumber must have the 11 digit phone number. I typically request the 10 digit number from the user and add the 1 in front.

  4. Lonnie Sohm says:

    Quick question: I understand what the ‘CallerNumber’ does, but what does ‘Name’ do?

    I modifed the .PHP to contain my number and my name and uploaded the file out to my host for testing, and when I path directly to the .PHP it does call me and connects me with my GV account. But where does the ‘Name’ component come into play? It is not displayed anywhere, so just curious what it does? The number that displays on my phone when the widget calls me is a California number with no name associated, and the GV voicemail only displays the caller number.

  5. Lonnie Sohm says:

    Never mind. I got ahead of myself. It took GV about 15 minutes to notify me that there was a call placed and showed the ‘Name’ in that notification. Patience… not my strongest virute.

  6. Snipsta says:

    You know I am not 100% sure The Google widget itself sends the name and requires it. So I did the same and had the same question. Not really sure but it may be for “Announces caller’s name and gives answering options” which is part of the Google widget settings in your Google voice account.

    I will look into it some more and get back with you.

  7. Snipsta says:

    If any one is interested I could bundle up my solution for you guys. It required jQuery and PHP. that’s its :) . Let me know and i will spend some time on it.

  8. Lonnie Sohm says:

    If you are willing to bundle that up, that would be great! I’m always up for playing with new things and seeing how I can apply them in my environment!

    Thanks!

  9. Snipsta says:

    Sure thing give me a couple days to make a standalone version.

  10. Paul Smith says:

    That would be great! Do you know if it’s something that could be dropped into, say,a Typepad site, as a widget, etc?

  11. Expatnomore says:

    If you could do that it would be great, I too am looking for a widget solution for Typepad!

  12. laurel says:

    Hi, I love this! Actually, your example is perfect for my site. However, I have no idea how to do this. If you get a package put together, please email me. I’ll be happy to pay something for this. I use Joomla!

  13. Christian says:

    You should format your code samples so that when somebody copies it it doesn’t also pick up the line numbers.

  14. JC says:

    I was wondering if this code was still working or if there is a workaround for it. Everytime that I try to run it, I get no return from the curl_exec call. I have also tried using $url = ‘https://clients4.google.com/voice/embed/webCallButton’ since that is what the url is showing throughout the google provided widget but I get the same error. Any thoughts?

  15. mike says:

    it worked great!! I got it to work with the php code and each time I refresh the page it calls again. This is nice!

    ’1′,
    ‘callerNumber’ => “$phone”,
    ‘buttonId’ => ’9ea … 91d3166′,
    ‘name’ => ‘mike’
    );
    $t = http_build_query($postVars);

    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_POST,count($postVars));
    curl_setopt($ch,CURLOPT_POSTFIELDS,$t);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    echo $result;
    exit;
    ?>

  16. mike says:

    it cut off the first part
    $url = ‘https://clients4.google.com/voice/embed/webButtonConnect’;
    //person wanted to call me
    $phone = ’2089991234′;
    $postVars = array(
    ‘showCallerNumber’ =>

  17. brady says:

    How are you doing on bundling this up? I would love to tinker with it.

    Thank you,
    b

  18. Mike says:

    I would like to know how to modify the google voice widget to match my website? I would like have the widget instead of saying Call me say Call us? Can you help me.

    My Best,
    Mike

  19. Jeff Dierking says:

    So the number is just a raw number?

    So I could do this for a widget that would allow international callers?

  20. jeff says:

    can someone help me get this google call widget on my sites…

  21. jeff says:

    or just talk me through it.. I’m really dense at this

  22. Andre says:

    Snipsta, would you please post an fla file for us?
    please please please :)

  23. Andre says:

    Snipsta, would you send me the jquery / php bundle please?

    Thank You

  24. Kevin says:

    Snipsta,

    If you have the jquery / php code bundled, could you please send me a copy? I would love to tinker with it.

    Thank You

  25. TM says:

    Snipsta, I too would love it if you could send me the bundle please. This is really nice… I am a newbie at this php and jquery stuff.

    Thanks

  26. bill gatets says:

    Wow, these kids would probably ask you to mow their lawn and brush their teeth for them too. Sad.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>