Upgraded to WordPress 6.0 and have issues? Please check the hotfix which you need to apply.

Okay
  Public Ticket #1875030
Integrate SMS API with Appointments
Closed

Comments

  • hazemshokry started the conversation

    Hello,

    Beside the confirmation emails for appointments, I want to also send an sms using my SMS API.

    What I can provide is an URL like this:

    https://sms.com/SENDERID/PASSWORD/SMSTEXT

    How can I fetch this url after a user request an appointment or newly register to the website?

  • hazemshokry replied

    I'm still waiting a reply to my inquiry!!

  •  104
    FlexiPress replied

    Hi there,

    Please sorry for this late response.

    All you need to do is add the following code into functions.php file:

    if ( !function_exists('dentalpress_user_register') ) {
        function dentalpress_user_register( $user_id ) {
            $sender_id = '';
            $password = '';
            $sms_text = '';         $response = wp_remote_get('https://sms.com/'. $sender_id .'/'. $password .'/'. $sms_text);         if ( !is_wp_error( $response ) ) {
                echo wp_remote_retrieve_body($response);
            } else {
                echo $response->get_error_message();
            }
        }     add_action( 'user_register', 'dentalpress_user_register', 10, 1 );
    }

    Thanks and cheers,


    FlexiPress Support

    Follow on     Envato     Facebook     Twitter

  • hazemshokry replied

    Thanks for the help, this code will help fetching the url after a user registers. How can I make it to be fetched after an appointment has been approved? I mean immediately after the Booked appointment plugin send it's notification via email (The attached screen shot might help understanding my request).

     Another question, I have a custom field in my Booked Appointments, how can I add this as a parameter in my wp_remote_get function?


  •  104
    FlexiPress replied

    Here's the code:

    if ( !function_exists('dentalpress_booked_approved_email') ) {
        function dentalpress_booked_approved_email( $email, $email_subject, $email_content ) {
            $sender_id = '';
            $password = '';
            $sms_text = $email_content;         $response = wp_remote_get('https://sms.com/'. $sender_id .'/'. $password .'/'. $sms_text);         if ( !is_wp_error( $response ) ) {
                echo wp_remote_retrieve_body($response);
            } else {
                echo $response->get_error_message();
            }
        }     add_action( 'booked_approved_email', 'dentalpress_booked_approved_email', 10, 3 );
    }

    For more details please read Booked documentation and analyze the plugin's code.

    Kind regards,


    FlexiPress Support

    Follow on     Envato     Facebook     Twitter