=== CatCode SMS Notifications with SMSPortal for WooCommerce ===
Contributors: catcodestudio
Tags: sms, smsportal, order notifications, south africa, woocommerce
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sends WooCommerce order updates to customers and new-order alerts to you by SMS through your own SMSPortal account.

== Description ==

You sell with WooCommerce in South Africa and already buy SMS credits from SMSPortal, or want to. This plugin connects the two: when an order changes status, the customer gets a text, and you get one when an order comes in.

SMSPortal is a third-party product. This is an independent integration, not affiliated with or endorsed by SMSPortal.

= What it does =

* **A message for each order status**, custom statuses included. Processing and Completed are on from the start, the rest are one tick away.
* **Your own wording** with the customer's name, order number, total, payment link and more.
* **New-order alerts** to one or several of your own numbers.
* **Numbers fixed for you.** 082 123 4567, +27 82 123 4567 and 0027 82 123 4567 all reach the same phone. Orders from other countries use that country's code.
* **The cost before you save.** Each message box shows its length and credits, and warns about characters that make a message dearer.
* **Test mode.** SMSPortal checks each request but delivers nothing, so you can try the whole flow first.
* **The credit balance** on your settings page, and a record of each SMS on the order and in the Activity tab.

= Built not to waste credits or annoy customers =

* An order sends each message once, even if a status is changed back and forth.
* Sending happens in the background, so a slow network never slows the checkout.
* If SMSPortal does not answer, the message is tried again later. If you run out of credits or the key stops working, messages wait up to 48 hours, then are dropped rather than arriving days late.
* Numbers that opted out with your SMSPortal account are left out.
* A staging copy stays quiet. If the site's address changes, sending stops until you confirm that this is the real store, otherwise a test order would text a real customer.

// @pro-begin
= Pro =

Sold on [catcode.com.ua](https://catcode.com.ua/modules/smsportal-sms-woocommerce/) with a 7-day trial:

* **Delivery receipts.** See on the order and in the activity list whether each SMS really arrived, through signed SMSPortal webhooks.
* **Customer replies** appear as order notes, and an opt-out stops your offers to that number.
* **Send an SMS by hand** from the order screen.
* **Quiet hours.** Messages that come up at night go in the morning.
* **A different message per payment method**, for example your banking details for EFT.
* **Tracking number and link** in any message, from the fields your courier plugin fills in.
* **SMS offers.** A consent box at checkout, classic and block, and offers only to customers who ticked it, with an opt-out line added.
* **E-mail alerts** for refused credentials, no credits and a low balance.

// @pro-end
= What it does not do =

* It does not sell SMS credits. You buy them from SMSPortal and pay SMSPortal's rates.
* It does not register a Sender ID. The mobile network has the final say on whether yours is used.

== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. In the SMSPortal control panel, open API Keys from the profile menu and create a REST key. New accounts have no active API channel until you do this. The secret is shown only once.
3. Open **WooCommerce > SMSPortal SMS** and enter the Client ID and API secret. The secret is kept encrypted with your site's keys.
4. Turn on **Test mode** and place a test order. The Activity tab shows the outcome.
5. Turn test mode off when you are happy.

== Frequently Asked Questions ==

= Does this need a CatCode account? =

No. The plugin talks to SMSPortal directly, with your own API key.

= What does a message cost? =

SMSPortal charges by length: up to 160 characters is 1 credit, up to 306 is 2, up to 459 is 3. The price of a credit is between you and SMSPortal.

= Will old orders be texted when I connect? =

No. Only status changes after connecting send a message.

= A customer says they got nothing. What now? =

Open the order: the SMS box gives the state and the reason. Common reasons are a number that is not a mobile number, or a number that opted out with your account.

= Can customers opt out? =

SMSPortal blacklists a number on your account when its owner replies STOP, DELETE, REMOVE or OPT-OUT. The plugin asks SMSPortal to respect that list on every send.

== External services ==

This plugin connects to the SMSPortal REST API (rest.smsportal.com), a service of SMSPortal, which is what it exists for. It sends nothing until you connect an account.

* What is sent: your API credentials with each call. For each message: the customer's or your phone number, the message text (which can include the customer's name, order number, total and links), and an internal message reference.
* When: when you connect or read the balance, when you send a test, and when an order reaches a status with a message turned on.

// @pro-begin
With Pro, SMSPortal also calls your site when a message is delivered or a customer replies, if you set those webhooks up.

The Pro build also connects to catcode.com.ua to check the license key and offer updates, sending the key and the site address when you activate and periodically after that. [Terms](https://catcode.com.ua/terms/), [privacy policy](https://catcode.com.ua/privacy/).

// @pro-end
SMSPortal [terms of service](https://smsportal.com/terms-of-service/) and [privacy policy](https://smsportal.com/privacy-policy/).

== Screenshots ==

1. Connecting the SMSPortal account.
2. Messages for each order status with the credit estimate.
3. Activity with each message and its outcome.

== Changelog ==

= 1.0.0 =
* First release.
