=== CatCode Exotel Notifications for WooCommerce ===
Contributors: catcodestudio
Tags: sms, exotel, woocommerce, order notifications, india
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

SMS messages about WooCommerce orders through Exotel: the buyer is texted when the order status changes. Works with the DLT rules of India.

== Description ==

Sends an SMS to the billing phone number of the buyer when the status of an order changes, through your own [Exotel](https://exotel.com/) account. You edit the text of each message and put the DLT template ID next to it; the plugin does the rest in the background.

* **Order statuses** — an SMS for "Processing" and for "Completed", each with its own text, DLT template ID and an on/off switch.
* **DLT ready** — the DLT entity ID and the template ID go to Exotel with every message, as Exotel's Send SMS API asks for Indian numbers. A message to an Indian number without an entity ID is not sent, and the order note tells you why.
* **Placeholders** — shop name, order number, order total, billing first and last name, status name and the link to the order page.
* **Phone numbers sorted out** — numbers are turned into the international form (+91…) using the billing country, so "98765 43210", "098765 43210" and "+91 98765 43210" all work.
* **Sent once** — each status sends one message per order, even when the status changes twice in a row or two requests overlap. A message that could not reach Exotel (or got HTTP 429 or 5xx) is retried once after five minutes; one that Exotel refused (bad number, DLT, no balance) is not repeated, and the reason is written to the order notes.
* **Everything is in the order notes** — what was sent, to which number, or why it was not.
* **Test message** — a test SMS to your own phone is one click away; "Check connection" reads your wallet balance.
* **Optional consent** — add a checkbox "Send me SMS messages about my order" to the checkout (classic and block) and text only those who tick it.
* HPOS and block checkout compatible. The API key and token are stored encrypted.
// @pro-begin
* Translations included: English.
// @pro-end

// @pro-begin
= Pro =

The Pro version is sold on [catcode.com.ua](https://catcode.com.ua/modules/catcode-exotel-notifications-for-woocommerce/), with a 7-day trial that never starts by itself:

* **Cash on delivery confirmation** — a COD order gets an SMS ("Reply YES to confirm or NO to cancel") and waits on hold; the reply, received through the Exotel inbound SMS webhook, moves it to Processing or Cancelled.
* **Every order status** — on hold, cancelled, refunded, failed and your own statuses, each with its own text and template ID.
* **Delivery reports** — every message carries a status callback; the journal and the order notes show delivered or not delivered, with the reason from Exotel (for example DND).
* **SMS journal** — every message with the order, number, text and state.
* **New order alert** — an SMS to your own phone when an order comes in.
* **Low balance warning** — an e-mail to the site admin when the wallet balance falls below the limit you set.
* **Message from the order screen** — a free-text SMS to the buyer of that order.
* Updates from catcode.com.ua.

The licence runs for 1-5 years and includes updates and support for that term; a purchased licence keeps its Pro features after the term ends. One key covers two sites: the shop and its test copy.
// @pro-end

Exotel is a trademark of its owner. This plugin is an independent integration made by CatCode; it is not an official plugin of Exotel and is not affiliated with or endorsed by it. You need your own Exotel account, and for Indian numbers your own DLT registration.

== External services ==

The plugin connects to the Exotel API (Exotel Techcom Pvt. Ltd., [exotel.com](https://exotel.com/), API documentation at [developer.exotel.com](https://developer.exotel.com/)) at `api.in.exotel.com` (Mumbai) or `api.exotel.com` (Singapore), the one you choose in the settings, and only after you enter your credentials and tick a status.

* When a message is sent: the text of the message, the phone number of the recipient, your sender, the DLT entity and template IDs and the order number, together with your account SID, API key and API token for authentication. The text and the number come from the order, so they can contain the buyer's name and the order link.
* When you press "Check connection": the same credentials, to read the wallet balance.
// @pro-begin
* With every message (Pro): the address of your site that receives the delivery report.
// @pro-end

[Exotel privacy policy](https://exotel.com/privacy-policy/)

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active.
2. WooCommerce → **Exotel**. In the Exotel dashboard open Settings → API Settings → API Credentials and copy the account SID, the API key and the API token into the plugin; choose your region and enter your sender and DLT entity ID.
3. Press "Check connection", tick the order statuses, paste your approved DLT message templates and their IDs, and save.
4. Enter your own number, press "Send a test SMS", then place a test order.

== Frequently Asked Questions ==

= Do I need an Exotel account? =

Yes. The messages are sent and charged by Exotel through your account; the plugin does not sell SMS.

= Do I need DLT registration? =

For Indian numbers, yes: Exotel requires the DLT entity ID, and every message has to match a template approved on the DLT portal. Without it the operators block the SMS. The plugin sends what you enter; it does not register anything for you.

= Which phone numbers get a message? =

The billing phone of the order. With a missing or invalid number nothing is sent and an order note says so.

= A message was not sent. Where do I see why? =

In the notes of the order.

== Changelog ==

= 1.0.0 =
* First release.
