=== Kirisan ===
Contributors: kirisan
Tags: messaging, whatsapp, telegram, email, api
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send Kirisan template messages from PHP with kirisan_send(). Admin-only settings and template browser.

== Description ==

Kirisan connects your WordPress site to the [Kirisan API](https://docs.kirisan.com/docs/api/overview) so developers can send approved message templates from themes, plugins, or hooks.

* **Admin only** — menus, settings, and assets require the `manage_options` capability. Nothing is shown on the public site.
* **Getting started** — in-admin tutorial on the Kirisan home screen.
* **Settings** — account API token.
* **Channels** — multiple device/sender keys (several per channel supported).
* **Templates** — pick a channel key and copy ready-to-use `kirisan_send()` snippets (one template per call).
* **PHP API** — call `kirisan_send( $key_id, $target, $template_id, $variables )` from anywhere in PHP.

No shortcodes and no front-end forms. Sending is done only from your own server-side code. API host is fixed to `https://api.kirisan.com`.

Docs:

* [Authentication](https://docs.kirisan.com/docs/api/authentication)
* [Send API](https://docs.kirisan.com/docs/api/send)
* [Templates API](https://docs.kirisan.com/docs/api/templates)

A full developer tutorial also lives in `README.md` inside the plugin folder, and on **Kirisan → Getting started** after activation.

== Installation ==

1. Copy the `kirisan` folder to `wp-content/plugins/kirisan`.
2. Activate **Kirisan** in Plugins (Administrators only see the menu).
3. Open **Kirisan** (Getting started) for the in-admin tutorial, or **Kirisan → Settings** and paste your account API token from dash.kirisan.com → **Account → Settings**.
4. Open **Kirisan → Channels** and add one or more keys (device/sender tokens). You can add multiple keys on the same channel.
5. Open **Kirisan → Templates**, click **Refresh**, and copy a snippet for an approved, active template under the key you want.

== Frequently Asked Questions ==

= Who can see the plugin? =

Only users with the `manage_options` capability (Administrators). Visitors and other roles see no plugin UI, scripts, or shortcodes.

= How do I send a message? =

From PHP (theme, custom plugin, WooCommerce hook, etc.):

`
$result = kirisan_send( 'main-email', 'user@example.com', 42, array( 'name' => 'Alex' ) );
if ( is_wp_error( $result ) ) {
    // handle $result->get_error_message()
}
`

The first argument is the **key id** from Kirisan → Channels (not the channel name).

= Can I use multiple WhatsApp devices? =

Yes. Add multiple keys under **Kirisan → Channels** with channel WhatsApp and different device tokens. Each key gets its own snippets on the Templates page.

= Are tokens exposed publicly? =

No. Tokens are stored in WordPress options and shown only on the Settings screen to administrators. `kirisan_send()` is not a public HTTP endpoint.

== Changelog ==

= 1.0.0 =
* Initial release (finished).
* Getting started tutorial, Settings (account API token), Channels (device/sender keys with table + modal).
* Templates: channel tabs (WhatsApp → WABA → Email → Telegram), per-channel key picker, search by name, code snippet box with copy.
* Channel badges use dashboard brand colors.
* PHP API: `kirisan_send( $key_id, $target, $template_id, $variables )`.
* Admin-only UI; API host fixed to `https://api.kirisan.com`.
