Skip to content
ChatVendor ChatVendor

Integrations

Two ready-made ways in. Both talk to the same API, so anything you can do with one you can do with a plain HTTP request.

PHP SDK

v1.2.0 · PHP 8.1+ · MIT

A typed client with retries, typed errors and webhook verification. Laravel support is discovered automatically.

Install

The package is served from here rather than Packagist, so add the repository once. Run this inside an existing project — the config command needs a composer.json to write to.

composer config repositories.chatvendor composer https://chatvendor.net
composer require chatvendor/sms-gateway

Or add it to composer.json by hand:

{
    "repositories": [
        { "type": "composer", "url": "https://chatvendor.net" }
    ]
}

Use

use ChatVendor\Client;

$sms = new Client(getenv('CHATVENDOR_KEY'));

$message = $sms->send('+998901234567', 'Your code is 483921', [
    'idempotency_key' => 'order-1234-otp',
    'expires_in'      => 300,
]);

$message->status;        // queued
$message->isPending();

Laravel

# .env
CHATVENDOR_KEY=cv_live_xxxxxxxxxxxx

# anywhere
public function __construct(private \ChatVendor\Client $sms) {}

$this->sms->send($order->phone, "Order {$order->id} is ready", [
    'idempotency_key' => "order-{$order->id}-ready",
]);

Verifying a webhook

use ChatVendor\Webhook;

// Throws unless the signature verifies — there is no path where you
// act on unverified data by accident.
$event = Webhook::parse(
    $request->getContent(),                  // raw body, not the parsed array
    $request->header('X-SMS-Signature', ''),
    config('chatvendor.webhook_secret'),
);

Download the archive

21 KB · only needed if you install by hand

Download

sha256 5027939c34a79cbe7ee94ca18fc4485c6b81412fd1707f20576b6c4fbf976659

JavaScript, Python, Postman

The same API from Node.js / the browser and from Python — one file each, no dependencies beyond fetch / requests. Plus a Postman collection generated from the OpenAPI document.

@chatvendor/sdk (JS)

import { ChatVendor } from '@chatvendor/sdk';
const cv = new ChatVendor(KEY);
await cv.chats.send('wa_3', 9989…, { text: 'Salom' });
Download · 3 KB

chatvendor (Python)

from chatvendor import ChatVendor
cv = ChatVendor(KEY)
cv.leads.create(account_id="wa_3", peer_id=9989…, title="Ali")
Download · 3 KB

Postman

Import the collection, set apiKey — every endpoint with a sample body.

Download collection

WordPress plugin

v1.1.0 · WP 6.0+ · GPL-2.0

Message customers when a WooCommerce order changes status — by SMS or through a WhatsApp number connected in ChatVendor — push every new order into the sales pipeline as a lead, text yourself when one arrives, or send from your own code with one function call.

No Composer, no bundled libraries. A plugin that ships its own copy of a HTTP client eventually collides with another plugin's copy, and the site owner gets a fatal error they cannot diagnose — so this uses the WordPress HTTP API and nothing else.

chatvendor-sms 1.1.0

14 KB · upload under Plugins → Add New → Upload

Download plugin

sha256 314f2a9ae46c055dd14cdbb695a008938bf5ac81811e0511431ee88a8f2e934a

Setting it up

  1. 01 Upload the zip under Plugins → Add New → Upload Plugin, and activate it.
  2. 02 Open Settings → ChatVendor SMS.
  3. 03 Paste an API key from your dashboard. The page then shows whether a phone is online.
  4. 04 Send a test message to confirm it works before switching order notifications on.

Sending from your own code

chatvendor_send_sms(
    '+998901234567',
    'Your code is 483921',
    array( 'idempotency_key' => 'order-' . $order_id )
);

WooCommerce placeholders

{order_number} Order number
{status} The status it just moved into
{total} Order total
{first_name} Billing first name
{site} Your site name

Two things that apply to both

Send an idempotency key

Without one, a request that times out and gets retried delivers a second SMS. Both integrations accept idempotency_key; use a reference you already have, like an order id. For an OTP or a payment confirmation this is the difference between a working integration and a support ticket.

Test without spending credit

An cv_test_ key runs the whole flow — queued, assigned, sent, webhooks fired — without touching a SIM. Use one on staging so integration work never messages a real person by accident.

Neither library is required. The API is plain HTTP and JSON, and works from anything.