wp_sms_send (Action)
Action hook triggered after an SMS message is sent successfully.
The wp_sms_send action fires after an SMS message is successfully sent through WSMS. Use this hook to perform custom actions such as logging, sending notifications, or integrating with third-party services.
Syntax
add_action('wp_sms_send', 'your_callback', 10, 1);
Parameters
| Parameter | Type | Description |
|---|---|---|
$message_info | mixed | Information about the sent SMS message |
Example
Send an email notification whenever an SMS is sent:
add_action('wp_sms_send', 'send_mail_when_send_sms');
function send_mail_when_send_sms($message_info) {
wp_mail('admin@example.com', 'SMS Sent', print_r($message_info, true));
}
Log SMS Activity
add_action('wp_sms_send', function($message_info) {
error_log('SMS sent: ' . print_r($message_info, true));
});
Integrate with External Service
add_action('wp_sms_send', function($message_info) {
wp_remote_post('https://your-api.com/log', array(
'body' => array(
'event' => 'sms_sent',
'data' => $message_info,
),
));
});
Use Cases
- Send email notifications when SMS is dispatched
- Log SMS activity for analytics
- Track SMS campaign success
- Integrate with CRM or marketing tools
- Trigger follow-up workflows
Related
- wp_sms_send() - Function to send SMS messages
- wp_sms_add_subscriber - Action hook for new subscribers
Last updated: December 23, 2024