Integration

WooCommerce order texts, sent from your own phone

Order placed, paid, shipped, ready for pickup: each status can text the customer automatically, from the phone number they already know, with nothing per message. Install the plugin, paste your key, write one line per status.

Form-encoded POST, JSON back, HTTP always 200. Read the status field.

  • 1 requestPOST /api/send/sms with secret, device, phone, message.
  • 0 per messageSends ride on the SIM plan of the phone you paired.
  • 5 secondsWebhook timeout for replies. Ack fast, work later.

lang_undefined

lang_undefined

lang_undefined · lang_undefined REST API

lang_undefined

  1. Pair an Android phone in your dashboard (Devices, Add device, scan the QR code) and copy its device ID.
  2. 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.
  3. 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.

  1. Download the WooCommerce plugin from your SharkSMS dashboard (Tools, WooCommerce) and install it under Plugins, Add New, Upload.
  2. In the plugin settings paste your API secret and choose the device (your paired phone) it should send from.
  3. 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.
  4. 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.

Straight answers

Do I need an SDK?

No. It is one HTTPS POST with a form body. Any language that can make an HTTP request can send. The snippets on this page are complete.

Can my code receive replies?

Yes. Add a webhook under Tools, Webhooks and every incoming SMS or WhatsApp message is POSTed to your URL as a form body with the sender, the text and a timestamp. See the webhooks reference.

Can customers reply to the order text?

Yes. Replies land on the paired phone and in your SharkSMS inbox, and can be pushed to your helpdesk by webhook. A customer asking to change the address reaches you the same way as any other text.