I am trying to send MESSAGES when a customer is

    Registered or he/she
    Reset his/her password
    Or any specific events that will be decided later .

I have an SMS API.

Suggest some step.

I just want to know how to trigger the API when a customer registered. Is there any hook available by which i can trigger my custom function.

UPDATE : My Problem is solved & Thank You @TomC

 if ( is_user_logged_in() ) {

    $user_id = get_current_user_id();
    $registration_field_1 = get_user_meta( $user_id, 'registration_field_1', true );
    $smsDone = get_user_meta( $user_id, 'smsDone', true );

    if(!empty($smsDone) && $smsDone === 'True'){
        $respuesta = wp_remote_get( "http://apiWebsite.com/messageapi.asp?username=key&password=somepwd@1&sender=key2&mobile=".$registration_field_1."&message=Your%20Profile%20is%20registered%20successfully%20.%20You%20are%20precious%20to%20us%20and%20we%20are%20glad%20to%20serve%20you%20better.%20Regards,%20The%20Astrochannel%20Team.");
        update_user_meta( $user_id, 'smsDone','True'   ); 

I used this method to send the sms once a customer is registered.

  • Did you search at all? What have you tried and not working? Also by customer you imply that you are using an e-shop plugin like WooCommerce, right ? Please read How to ask
    – Laxmana
    Apr 26, 2017 at 12:54
  • is there any relation between woo commerce and sending SMS when any user registers themselves. Sorry, I am not getting your point.
    – inrsaurabh
    Apr 26, 2017 at 12:57
  • It is because WooCommerce might have their actions and filters upon registration and mention it would help to get a better answer. For example woocommerce_created_customer action fires when a new customer is registered / created
    – Laxmana
    Apr 26, 2017 at 13:03
  • 2
    well, seems like first you need a phone number to send the sms .... not sure what is exactly the answer you expect here, please edit the question and add actuall details not just highlights. Apr 26, 2017 at 15:45

1 Answer 1


If you're talking about Wordpress user registration, you want to start by reading about the User Register hook: https://codex.wordpress.org/Plugin_API/Action_Reference/user_register

Then your code would be something like this which will automatically fire each time a user registers on the site:


function send_sms($user_id){
  // Code for your SMS API Here

The code would go in a plugin or in your Theme's functions.php file. If you're talking about an ecommerce plugin, you need to see what action hooks they have available for customer registration and use that as per the developer documentation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.