Before you follow this tutorial, you must have configured Twilio with Notification Pack.
Customize your SMS notifications
Now you will be able to customize your SMS notifications.
- Go to the Booking Activities settings, “Notifications” tab
- Click the desired notification in the available notifications list. On this page, you will find a “SMS notification settings” section
- Enable SMS notification
- If the notification is addressed to an administrator, you can enter the phone number of the recipient(s) (comma separated)
- The telephone numbers must include their country code (e.g.:
+44
for the UK) and omit the initial “0” (e.g.:+44612345678
)
- The telephone numbers must include their country code (e.g.:
- Input the SMS content
- You can use tags (e.g.:
{booking_id}
) but not HTML - You are limited to 160 characters per SMS, and they must all be included in this table. If one of them is different (e.g.: “ê”, “ç”, “б”, “私”, “☺”, etc.), your quota drops to 67 characters.
- If you exceed the number of characters allowed, you will not send one, but several SMS. Your balance will decrease accordingly.
- You can use tags (e.g.:
Retrieve your customers’ phone number
If you use WooCommerce, Notification Pack will naturally use the phone number in the “Phone” field of the user’s billing address. If the country code (e.g.: +44
) is not specified, it will use the billing country to determine it.
If you do not use WooCommerce or if you do not want to use the billing address phone number, here’s how to proceed. SMS notifications will use the phone number stored in the phone
field of the usermeta
table.
In your registration forms make sure you have a field
<input type="text" name="phone" />
Then save its value this way
update_user_meta( $user_id, 'phone', $_GET['phone'] );
If the name of the “phone” field does not suit you, you can change it by placing this code in your theme’s functions.php
:
add_filter( 'banp_user_phone_meta_key', function( $key ) { return 'your_field_name'; } );
Get customers’ permission
Now that you have your customers phone numbers, you have to make sure they are willing to receive SMS from you.
Notification Pack provides a shortcode that will allow you to display a subscribe / unsubscribe button: [banp_sms_permission_button]
.
Your customers will only have to click on it to allow you to send them SMS or not.
If you do not want to go through this button, just store 0
or 1
in the banp_sms_allowed
field in the usermeta
table.
However, you can bypass this check:
- Go to the Booking Activities settings, “Notifications” tab
- Enable the option “Allow default SMS”
Thus, you consider everyone as subscribed until one do unsubscribe. Indeed, you can still unsubscribe using the shortcode button mentioned above.
You are now ready to send SMS to your customers!
We now invite you to configure Notification Pack to send Push notifications. If you have already done so, find out how to embed event-specific messages in your notifications.