Skip to content

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.4.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

22 KB · only needed if you install by hand

Download

sha256 aa9fe16182992acd7b11353e21c175cdb4ae8f3d78f51eb0bd31670661f62ed8

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 · 4 KB

Postman

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

Download collection

WordPress plugin

v2.0.0 · WP 6.0+ · GPL-2.0

One plugin connects the whole site: the live chat widget on every page, entries from Contact Form 7, WPForms, Gravity Forms, Fluent Forms, Ninja Forms and Elementor as conversations and leads, WooCommerce orders in the pipeline, order messages by SMS or WhatsApp, and sign-ups as contacts. Nothing is lost when ChatVendor is unreachable: entries are kept and retried.

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 2.0.0

25 KB · upload under Plugins → Add New → Upload

Download plugin

sha256 c6d9ab8d87ae09eb0fb08c9744053ebc219778200e10c5d68d8d7927f2ae4cf1

Setting it up

  1. 01 Upload the zip under Plugins → Add New → Upload Plugin, and activate it.
  2. 02 Open ChatVendor in the admin menu and paste an API key from your dashboard.
  3. 03 On the Chat widget tab, create the chat for this site. Logged-in customers arrive with their name.
  4. 04 Form plugins are picked up on their own. Switch on WooCommerce and SMS on their tabs when you need them.

From your own code

chatvendor_submit_lead([
    'source'  => 'Price calculator',
    'name'    => 'Ali',
    'phone'   => '+998901234567',
    'message' => 'Needs a quote',
]);

Sending an SMS

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.