> ## Documentation Index
> Fetch the complete documentation index at: https://docs.telaven.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create WhatsApp campaign

> Send an approved template to many people, personalised for each one, now or at a set time. Opted-out numbers are skipped; each message is charged as it's sent.

Scope: `whatsapp:send`.

If the wallet runs out mid-way the campaign stops with status `failed`; top up and resume it with Update WhatsApp campaign. Nobody is charged or messaged twice.



## OpenAPI

````yaml /openapi.json post /whatsapp/campaigns
openapi: 3.1.0
info:
  title: Messaly API
  version: 1.0.0
  description: >-
    SMS, WhatsApp, email, contacts and CRM for your business. Amounts are in
    KES. Authenticate with an API key (Settings → API keys). A key can be
    limited to scopes and to IP addresses; a key with no scopes can call every
    endpoint here.
servers:
  - url: https://app.telaven.com/api/v1
    description: Production
security:
  - bearerAuth: []
  - apiKeyHeader: []
tags:
  - name: Account
    description: Wallet balance and SMS pricing.
  - name: SMS
    description: Send SMS and read messages and analytics.
  - name: SMS campaigns
    description: Create, schedule and send SMS campaigns to lists and tags.
  - name: Contacts
    description: Contacts and contact lists.
  - name: WhatsApp
    description: Send approved WhatsApp templates.
  - name: Email
    description: Email campaigns and unsubscribes.
  - name: CRM
    description: Deals, companies and pipelines.
paths:
  /whatsapp/campaigns:
    post:
      tags:
        - WhatsApp
      summary: Create WhatsApp campaign
      description: >-
        Send an approved template to many people, personalised for each one, now
        or at a set time. Opted-out numbers are skipped; each message is charged
        as it's sent.


        Scope: `whatsapp:send`.


        If the wallet runs out mid-way the campaign stops with status `failed`;
        top up and resume it with Update WhatsApp campaign. Nobody is charged or
        messaged twice.
      operationId: createWhatsappCampaign
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Optional. A unique value (e.g. a UUID) per operation, up to 255
            characters. Retrying with the same key and body returns the first
            response instead of doing it again. Kept 24 hours.
          schema:
            type: string
            example: 5f1c2b0e-8d6a-4c1f-9a43-2b7e0f6d1a90
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: November offer
                  description: For your reference.
                templateId:
                  type: string
                  format: uuid
                  description: An approved template. (Or `templateName` + `language`.)
                contactListIds:
                  type: array
                  items:
                    type: string
                  description: Send to these contact lists…
                tags:
                  type: array
                  items:
                    type: string
                  description: …and/or contacts with these tags.
                upload:
                  type: array
                  items:
                    type: object
                  description: >-
                    Or your own recipients (up to 10,000): `{ phone, name?,
                    email?, fields?: { column: value } }`.
                variableMap:
                  type: object
                  description: >-
                    Where each variable's value comes from, per recipient. `{
                    body: { "1": source }, header?: {…}, buttons?: { "0": source
                    } }`, where a source is `{ source: "contact", field: "name"
                    | "first_name" | "phone" | "email" }`, `{ source: "column",
                    column }` (from `upload[].fields`) or `{ source: "fixed",
                    value }`.
                headerMedia:
                  type: object
                  description: >-
                    For a media-header template: `{ type: "image" | "video" |
                    "document", link, filename? }` (a public https link).
                scheduledAt:
                  type: string
                  description: Send later. Omit to send now.
              required:
                - name
                - templateId
            example:
              name: November offer
              templateId: 7d2c…
              upload:
                - phone: '0712345678'
                  name: Jane Wanjiku
                  fields:
                    code: JANE10
                - phone: '0722000111'
                  name: Otieno
                  fields:
                    code: OTI10
              variableMap:
                body:
                  '1':
                    source: contact
                    field: first_name
                  '2':
                    source: column
                    column: code
              scheduledAt: '2026-11-20T09:00:00+03:00'
      responses:
        '201':
          description: Success
          content:
            application/json:
              example:
                success: true
                data:
                  id: c51a…
                  name: November offer
                  status: scheduled
                  totalRecipients: 2
                  estimatedCostCents: 300
                  scheduledAt: '2026-11-20T06:00:00.000Z'
        '400':
          description: >-
            No template or recipients, a variable without a source, a media
            header without `headerMedia`, or no valid numbers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: No API key, or the key is wrong, disabled or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            VERIFICATION_REQUIRED: The platform requires account verification
            before sending, and yours isn't approved yet. / The key doesn't have
            the scope this endpoint needs, or it's used from an address its IP
            allowlist doesn't include.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            IDEMPOTENCY_IN_PROGRESS: A request with this Idempotency-Key is
            still running. Wait and retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            IDEMPOTENCY_KEY_REUSED: This Idempotency-Key was already used for a
            different request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            More than 120 requests in a minute with this key. Wait for the
            number of seconds in Retry-After.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: >-
            Something went wrong on our side. Retry with backoff. A POST sent
            with an Idempotency-Key replays this same error for that key,
            because the request may have partly run: check the result before
            trying again with a new key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        code:
          type: string
          description: Machine-readable code where one exists, e.g. INSUFFICIENT_BALANCE.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Authorization: Bearer tlv_…'
    apiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.