Posted by & filed under PHP, Twilio, WordPress.

I modeled Click2Client after a similar WordPress plugin, wp-click2call. My finished project was similar to the original, but did not have the same functionality (namely, the ability for the customer to call the author in one click). Luckily, it’s pretty simple to make a similar application very quickly. Here’s how:

  1. Install the wp-click2client plugin
  2. Create an xml file that looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
      <Dial callerId='VERIFIED'>
        <Number>NUMBERTODIAL</Number>
      </Dial>
    </Response>
    

    Be sure to replace VERIFIED with a Twilio Verified phone number (preferably in the 11-digit format +11231231234), and NUMBERTODIAL with the number you would like the customer to call (i.e. Sales dept). For more customized behavior, read the documentation.

  3. Upload the XML file: In your WordPress Admin panel sidebar, go to Media->Add New. Upload your xml file, then select Edit and copy the File URL.
  4. Create a Twilio Application: In your Twilio Account’s Apps page, click the “Create TwiML App” button. Name it something, like “WP Click2Client Forward”, then paste the File URL from the previous step into the Request URL. Save it, and copy the App’s Application Sid (34 digit ID, starts with “AP”).
  5. Make the Click2Client button: Paste the code in where you want the button to show up
    [wp_click2client id="ApplicationSid"]

Replace ApplicationSid with the Application Sid from the previous step, and that’s it! Anyone who presses that button will be immediately connected to your phone through their browser.

See an example.

16 Responses to “Click2Client – Call Me button”

  1. LT

    I am unable to upload the XML file through the Live site. Where should the file be uploaded if using FTP?

    • alex

      If you are using FTP to upload files, you just need to put the file somewhere within the web server’s directory. If the wordpress directory is the root, you might want to sneak it into the proper folder of /wp-content/uploads. I haven’t tried doing this manually, but I suspect you will need to remember the path yourself to form the link, because the file may not show up in the media library page.

    • alex

      It looks like the shortcode handler isn’t set up properly. You need WordPress 2.5 or greater (which it looks like you have). I suggest deactivating/reactivating the plugin.

  2. SAgar

    Hi We tried everything but were unable to get it working followed all the steps you gave in order to get the wordpress click2call pluggin work but then when we insert the code pacth in a page it just doesnt work.

    • alex

      “It doesn’t work” isn’t enough information for me to help you. Is the shortcode not working, like Matt’s issue? Are there any logs or console output?

  3. Naveenkumar Tarigonda

    Hi,
    I want to use twilio app to mysite,I follow all above steps to create twilio but i’m unable to bring button on mysite and I used “” above snippet of code still i’m unable to bring twilio button help me
    Thank you

  4. jan

    Alex
    thanks so much
    you made it work for me!
    I love twilio but have a hard time making it work
    thanks again for the tutorial!

  5. brandon

    Alex,

    This is great.

    I got everything set up, but I am having an issue with the Digits field.

    The Digits input will not allow more than one digit before it rewrites the input field.

    Thanks for putting this together!

    • alex

      Yes, the digits are removed, but the tone is played and the input is taken as it should.

  6. Anil Kumar

    Hi,

    I am trying to create twilio app, after entring url of xml file which has been uploaded in wordpress site, it give error while clicking on save button.

  7. John smith

    Hi,

    I love the twilio app it succesfully installed and working with php bb shortcode [wp_click2client id="ApplicationSid"] but i want to use this in my header.php but it seems in header.php bb code doesnt works please help me

Trackbacks/Pingbacks

  1.  WordPress Calling Plugins Help You To Convert Visitors Into Customers