Send SMS to new subscribers after 3 days subscriptions

Updated on Mar 08, 2022

If you would like to send out an SMS 3 days after someone subscribed, here is the hook that you have to use

add_action('wp_sms_add_subscriber', 'sendWelcomeSmsToNewSubscribersAfter3Days', 10, 2);

/**
 * @param $name
 * @param $mobile
 */
function sendWelcomeSmsToNewSubscribersAfter3Days($name, $mobile)
{
    WPSms()->scheduled()::add(
        date('Y-m-d H:i:s', strtotime('+3 day')),
        WP_SMS\Option::getOption('gateway_sender_id'),
        sprintf('Hello %s', $name),
        array($mobile)
    );
}