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

# Send a communication

> Sends an approved template to up to 500 phone numbers (WhatsApp) or email addresses,
through the company's WhatsApp line. Up to 100 valid recipients are queued during the
request; above that the send is processed in the background and `status` is `PENDING`.
Send an `Idempotency-Key` header to make retries safe: a repeated key returns the
original result without sending again.




## OpenAPI

````yaml /openapi.yaml post /v1/communications/send/
openapi: 3.1.0
info:
  title: hackU Client API
  version: 1.2.0
  description: >
    Public API for hackU corporate clients. It lets a company manage its
    learners

    (create, update, deactivate), enroll them in courses (routes) and pensums,

    read their progress, and send WhatsApp / email communications.


    **Authentication.** Every request must send the header

    `Authorization: Api-Key <token>`. The key identifies the company; there is
    no

    company parameter in the URL except where noted.


    **Pagination.** List endpoints that are paginated use limit/offset

    (`limit` default 50, maximum 500) and return `{count, next, previous,
    results}`.


    **Errors.** A missing, invalid, revoked or expired key returns `403` with

    `{"detail": "..."}`. Validation errors return `400` with

    `{"<field>": ["<message>", ...]}` (or `non_field_errors`). Some messages are

    returned in Spanish.


    **Identifiers.** `user_id` in every path is the hackU user id, returned as

    `user_pk` by `POST /clients/users/` and as `id` by `GET /clients/users/`.
servers:
  - url: https://app.reinvented.education/api
    description: Production
  - url: https://qa-admin.hacku.co/api
    description: Test
security:
  - ApiKeyAuth: []
tags:
  - name: Users
    description: Create, read, update and deactivate the company's learners.
  - name: Enrollment
    description: Assign courses (routes), modules and pensums.
  - name: Progress
    description: >-
      Read learners' progress in courses, modules, pensums, evaluations, surveys
      and certificates.
  - name: Catalog
    description: The company's courses (routes) and their modules.
  - name: Extra fields
    description: Company-defined custom user fields.
  - name: Communications
    description: Send WhatsApp or email messages using approved templates.
paths:
  /v1/communications/send/:
    post:
      tags:
        - Communications
      summary: Send a communication
      description: >
        Sends an approved template to up to 500 phone numbers (WhatsApp) or
        email addresses,

        through the company's WhatsApp line. Up to 100 valid recipients are
        queued during the

        request; above that the send is processed in the background and `status`
        is `PENDING`.

        Send an `Idempotency-Key` header to make retries safe: a repeated key
        returns the

        original result without sending again.
      operationId: sendCommunication
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: Any unique string (max 255 chars), scoped to the company.
          schema:
            type: string
            maxLength: 255
          example: 7d9f2c1e-order-1042
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendCommunicationRequest'
      responses:
        '202':
          description: Accepted. Invalid recipients are skipped and listed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendCommunicationResult'
        '400':
          description: >-
            Validation error, or the company has no WhatsApp line configured
            (`{"detail": ...}`).
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ValidationErrors'
                  - $ref: '#/components/schemas/Error'
              examples:
                missingVariables:
                  value:
                    variables:
                      - 'Missing required variables: 1, 2'
                noGateway:
                  value:
                    detail: Company has no WhatsApp gateway configured.
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: >-
            The template is an offline template and cannot be sent through
            WhatsApp here.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Sending would exceed the WhatsApp line's daily limit (Meta messaging
            tier minus messages already sent or scheduled today).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: >-
                  Daily WhatsApp messaging limit exceeded for this line.
                  Remaining today: 120.
components:
  schemas:
    SendCommunicationRequest:
      type: object
      required:
        - template_slug
        - variables
        - channel
        - recipients
      properties:
        template_slug:
          type: string
          description: >-
            Slug of an approved template owned by the company (or a shared
            template).
        variables:
          type: object
          description: >
            Template variables keyed by position (`"1"`, `"2"`, ...). Every
            required variable

            must be present. A value may be a string or `{"value": "..."}`. URLs
            in values are

            shortened automatically.
          additionalProperties:
            oneOf:
              - type: string
              - type: object
                properties:
                  value:
                    type: string
        channel:
          type: string
          enum:
            - whatsapp
            - email
        recipients:
          type: array
          minItems: 1
          maxItems: 500
          description: >-
            Phone numbers in international format (a missing `+` is added) for
            WhatsApp, or email addresses. Invalid entries are skipped and
            returned in `invalid_recipients`.
          items:
            type: string
        media:
          type: object
          description: Attachment uploaded with `POST /v1/communications/media/`.
          required:
            - url_pk
            - media
          properties:
            url_pk:
              type: integer
            media:
              type: string
              enum:
                - image
                - video
                - document
      example:
        template_slug: recordatorio-curso
        channel: whatsapp
        variables:
          '1': Ana
          '2': https://example.com/curso
        recipients:
          - '+573001112233'
          - '573004445566'
          - not-a-phone
        media:
          url_pk: 2207
          media: image
    SendCommunicationResult:
      type: object
      properties:
        id:
          type: integer
          description: Send log id.
        status:
          type: string
          enum:
            - PENDING
            - COMPLETED
            - PARTIAL
            - FAILED
          description: >-
            PENDING: more than 100 valid recipients, processed in background.
            COMPLETED: all queued. PARTIAL: some recipients were invalid.
            FAILED: nothing could be queued.
        queued:
          type: integer
          description: Messages queued (or to be queued when PENDING).
        invalid_recipients:
          type: array
          items:
            type: string
      example:
        id: 8812
        status: PARTIAL
        queued: 2
        invalid_recipients:
          - not-a-phone
    ValidationErrors:
      type: object
      description: >-
        Field name (or `non_field_errors`) mapped to a list of messages. Nested
        serializers return nested objects.
      additionalProperties: true
      example:
        email:
          - Enter a valid email address.
        selected_days:
          - Day funday is not valid.
    Error:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
  responses:
    Forbidden:
      description: Missing, invalid, revoked or expired API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: Authentication credentials were not provided.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Company API key. The header value must be `Api-Key <token>`, e.g.
        `Authorization: Api-Key AbCd1234.xxxxxxxx`.

````

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