Contact Form 7 SMS integration with twilio

How do I setup so that I can send out SMS whenever someone has fill in the form? I’m using https://www.twilio.com for the sms.
Where do I include the actions in contact form 7 when submitting form? Appreciate any help here, thanks!

Related posts

4 comments

  1. Got it right with this 1, now what’s left is trying to echo the information submitted to the sms message. Can i use echo directly?

    Noticed this on filter changes as well, not sure it this affected http://contactform7.com/2015/05/18/contact-form-7-42-beta/

    add_action( 'wpcf7_mail_sent', 'your_wpcf7_mail_sent_function' );
    
    function your_wpcf7_mail_sent_function() {
       // Get the PHP helper library from twilio.com/docs/php/install
       require_once( get_stylesheet_directory() . '/twilio-php-master/Services/Twilio.php'); // Loads the library
    
       $account_sid = 'AC914e20c15791698c1d86cfc297e30f64'; 
       $auth_token = '1e962df32508157599929e545033c869'; 
       $client = new Services_Twilio($account_sid, $auth_token); 
    
       $client->account->messages->create(array( 
           'To' => "+60167833549", 
           'From' => "+13479604387", 
           'Body' => "form submited",   
       ));
    

    }

  2. You can hook yourself in to the CF 7 process.

    Have a look here, here and here for more information and some examples on how to do it.

    Hooking into where/after the mail is sent might be interesting for what you want to do.

Comments are closed.