lang_undefined
lang_undefined
lang_undefined
- Pair an Android phone in your dashboard (Devices, Add device, scan the QR code) and copy its device ID.
- Create an API key under Tools, API Keys, with the sms_send permission (and wa_send for WhatsApp). Copy the secret into an environment variable; never into source.
- A WordPress site with WooCommerce, and admin access to install a plugin.
lang_undefined
The plugin adds a SharkSMS tab to WooCommerce settings. Four steps.
- Download the WooCommerce plugin from your SharkSMS dashboard (Tools, WooCommerce) and install it under Plugins, Add New, Upload.
- In the plugin settings paste your API secret and choose the device (your paired phone) it should send from.
- Tick the order statuses that should text the customer: processing, completed, on hold, cancelled, refunded, failed. Optionally an admin alert per new order and a low-stock alert.
- Write one template per status using the merge tags below. Save. Place a test order.
Templates that work. Merge tags in square brackets are filled per order.
Processing: Hi [billing_first_name], order #[order_id] is confirmed. Total [order_amount] [order_currency]. We will text you when it ships.
Completed: Order #[order_id] is on its way, [billing_first_name]. Questions? Reply to this text.
On hold: Order #[order_id] is on hold until payment clears. [shop_name], [shop_url]
Prefer your own code? Any WooCommerce hook can call the API directly with a form POST. This sends on completion without the plugin.
// functions.php: send from your own hook if you would rather not use the plugin
add_action("woocommerce_order_status_completed", function ($order_id) {
$order = wc_get_order($order_id);
wp_remote_post("https://sharksms.com/api/send/sms", [
"timeout" => 15,
"body" => [ // form body, not JSON
"secret" => SHARKSMS_SECRET,
"mode" => "devices",
"device" => SHARKSMS_DEVICE,
"phone" => $order->get_billing_phone(),
"message" => "Order #{$order->get_order_number()} is on its way. Thanks for shopping with us.",
],
]);
});
lang_undefined
Send to your own phone first. Then call GET /api/get/sms.message with the returned messageId and type=sent and watch it go queued, sent. If it stays queued, the paired phone is off, offline or battery-optimised; see the Android gateway page.
lang_undefined
- The API reads a form body, not JSON. A JSON body is ignored and you get status 400 for missing parameters.
- HTTP is always 200. Branch on the JSON status field, never on the HTTP status.
- No deduplication. A retry after a timeout can send twice; record the messageId on success and check status before resending.
- Customers must have a phone number on the order; the plugin sends to the billing phone. Make the phone field required at checkout if it is not.