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

# Send Message

> Envoie un message au destinataire via l'API Shortext

<Tabs>
  <Tab title="Text">
    Text messages are messages containing only a text body and an optional link preview.

    <Card title="Text Message" img="https://mintcdn.com/n-ycorp/_ZaOYbkIIjdke_qI/images/text-message.png?fit=max&auto=format&n=_ZaOYbkIIjdke_qI&q=85&s=ff3bc9d19810e66ad43a89d74f28cb69" width="1585" height="664" data-path="images/text-message.png" />

    ## Link Preview

    You can have the WhatsApp client attempt to render a preview of the first URL in the body text string, if it
    contains one. URLs must begin with http\:// or https\://. If multiple URLs are in the body text string, only the
    first URL will be rendered.

    <Note>If omitted, or if unable to retrieve a link preview, a clickable link will be rendered instead.</Note>
  </Tab>

  <Tab title="Interactive Button Reply">
    <Card title="Interactive Button Reply">
      Interactive reply buttons messages allow you to send up to three predefined replies for users to choose from.

      <img height="200" src="https://mintcdn.com/n-ycorp/_ZaOYbkIIjdke_qI/images/interactive-button-reply.png?fit=max&auto=format&n=_ZaOYbkIIjdke_qI&q=85&s=d6be9cb4814b41f4259ddabd1aca47e6" data-path="images/interactive-button-reply.png" />
    </Card>

    <Card title="User respond to interactive button">
      Users can respond to a message by selecting one of the predefined buttons, which triggers a messages webhook describing their selection.

      <img height="150" src="https://mintcdn.com/n-ycorp/_ZaOYbkIIjdke_qI/images/interactive-button-sample-response.png?fit=max&auto=format&n=_ZaOYbkIIjdke_qI&q=85&s=851324f955fabca69c0715d228bbe036" data-path="images/interactive-button-sample-response.png" />
    </Card>
  </Tab>

  <Tab title="Interactive List Messages">
    <Card title="Interactive Button Reply">
      Interactive list messages allow you to present WhatsApp users with a list of options to choose from (options are defined as rows in the request payload):

      <img height="200" src="https://mintcdn.com/n-ycorp/_ZaOYbkIIjdke_qI/images/interactive-list.png?fit=max&auto=format&n=_ZaOYbkIIjdke_qI&q=85&s=31cb53526683f337fa96d99cfe707d4a" data-path="images/interactive-list.png" />
    </Card>

    <Card title="User respond to interactive button">
      When a user taps the button in the message, it displays a modal that lists the options available:

      <img height="150" src="https://mintcdn.com/n-ycorp/_ZaOYbkIIjdke_qI/images/interactive-list-modal.png?fit=max&auto=format&n=_ZaOYbkIIjdke_qI&q=85&s=3d651940c94d2617fe5e17bcdad795fc" data-path="images/interactive-list-modal.png" />
    </Card>

    <Card title="User respond to interactive button">
      Users can then choose one option and their selection will be sent as a reply:

      <img height="150" src="https://mintcdn.com/n-ycorp/_ZaOYbkIIjdke_qI/images/interactive-list-reply.png?fit=max&auto=format&n=_ZaOYbkIIjdke_qI&q=85&s=1dce5c0722a75df2b9837e4fd40b0b3b" data-path="images/interactive-list-reply.png" />
    </Card>

    <Note>Interactive list messages support up to 10 sections, with up to 10 rows per section, and can include an optional header and footer.</Note>
  </Tab>

  <Tab title="Third Tab">
    💪 Here's content that's only inside the third Tab.
  </Tab>

  <Tab title="Third Tab">
    💪 Here's content that's only inside the third Tab.
  </Tab>
</Tabs>


## OpenAPI

````yaml POST /messages/send
openapi: 3.1.0
info:
  title: Shortext API
  description: This is my API
  version: '1.0'
servers:
  - url: https://shortext.ny-corp.io/api
  - url: https://whatsapp-gateway.test/api
security: []
tags:
  - name: Agents
    description: Agents
  - name: Business - Manager
    description: Business - Manager
  - name: Messages
    description: Messages
  - name: Tickets
    description: Tickets
  - name: health
    description: health
paths:
  /messages/send:
    post:
      tags:
        - Messages
      summary: Send a message
      description: Envoie un message au destinataire via l'API Shortext
      operationId: sendMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
      responses:
        '200':
          description: ButtonReplyMessage sent successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    SendMessageRequest:
      required:
        - channel
        - contact
        - from
        - message
      properties:
        channel:
          type: string
          enum:
            - whatsapp
        contact:
          required:
            - phone
            - profile
          properties:
            phone:
              description: For channel whatsapp -> E.164 format without leading +
              type: string
              example: '1234567890'
            profile:
              required:
                - lastname
              properties:
                lastname:
                  type: string
                  example: Yoan
                firstname:
                  type: string
                  example: André
                email:
                  type: string
                  example: celia@home.io
                address:
                  type: string
                  example: Place to be
                preferred_language:
                  type: string
                  enum:
                    - en
                    - fr
                  example: en
              type: object
          type: object
        from:
          description: the id of the sender business number
          type: string
          example: '1234567890'
        message:
          properties:
            type:
              type: string
              enum:
                - text
                - media
                - interactive
                - template
              example: text
            content:
              oneOf:
                - $ref: '#/components/schemas/TextMessageContent'
                - $ref: '#/components/schemas/ImageMessageContent'
                - $ref: '#/components/schemas/VideoMessageContent'
                - $ref: '#/components/schemas/DocumentMessageContent'
                - $ref: '#/components/schemas/AudioMessageContent'
                - $ref: '#/components/schemas/InteractiveButtonMessageContent'
          type: object
      type: object
    SendMessageResponse:
      properties:
        success:
          type: boolean
          example: 'true'
        message_id:
          type: string
          example: abc123
        recipient:
          properties:
            phone_number:
              type: string
              example: '1234567890'
          type: object
        data:
          properties:
            sent_at:
              type: string
              format: date-time
              example: '2024-10-05T10:01:00Z'
            delivered_at:
              type: string
              format: date-time
              example: '2024-10-05T10:05:00Z'
            read_at:
              type: string
              format: date-time
              example: '2024-10-05T10:07:00Z'
          type: object
      type: object
    TextMessageContent:
      title: Text Message
      description: >-
        WhatsApp allow text message only when there is already an open session
        between the contact and the business number
      required:
        - text
      properties:
        text:
          description: 'for embedded url please use this format ex: https://shortext.io'
          type: string
          maxLength: 4096
          example: Ceci est un message texte.
        preview_url:
          type: boolean
          default: true
          example: true
      type: object
    ImageMessageContent:
      title: Image Message
      description: >-
        Image messages are messages that display a single image and an optional
        caption.
      required:
        - media_type
        - media_url
      properties:
        media_type:
          description: Get the validation rules that apply to the request.
          type: string
          enum:
            - image
          example: image
        media_url:
          type: string
          example: https://example.com/image.jpg
        caption:
          type: string
          maxLength: 1024
          example: Voici une image
      type: object
    VideoMessageContent:
      title: Video Message
      description: >-
        Video messages display a thumbnail preview of a video image with an
        optional caption. When the WhatsApp user taps the preview, it loads the
        video and displays it to the user.
      required:
        - media_type
        - media_url
      properties:
        media_type:
          type: string
          enum:
            - video
          example: video
        media_url:
          type: string
          example: https://example.com/video.mp4
        caption:
          type: string
          maxLength: 1024
          example: Voici une image
      type: object
    DocumentMessageContent:
      title: Document Message
      description: >-
        Document messages are messages that display a document icon, linked to a
        document, that a WhatsApp user can tap to download.
      required:
        - media_type
        - media_url
      properties:
        media_type:
          type: string
          enum:
            - document
          example: document
        media_url:
          type: string
          example: https://example.com/document.pdf
        name:
          description: >-
            Document filename, with extension. The WhatsApp client will use an
            appropriate file type icon based on the extension.
          type: string
          maxLength: 30
          example: Facture.pdf
        caption:
          type: string
          maxLength: 1024
          example: Voici une image
      type: object
    AudioMessageContent:
      title: Audio Message
      description: >-
        Audio messages display an audio icon and a link to an audio file. When
        the WhatsApp user taps the icon, the WhatsApp client loads and plays the
        audio file.
      required:
        - media_type
        - media_url
      properties:
        media_type:
          description: Get the validation rules that apply to the request.
          type: string
          enum:
            - audio
          example: audio
        media_url:
          type: string
          example: https://example.com/image.jpg
      type: object
    InteractiveButtonMessageContent:
      title: Interactive Button Reply Message
      properties:
        type:
          description: Get the validation rules that apply to the request.
          type: string
          enum:
            - button
            - payment
          example: button
        header:
          description: >-
            Text header doesn't allow formating like *<HEADER>* or any other
            format supported by WhatsApp
          properties:
            type:
              type: string
              enum:
                - text
                - image
                - video
                - document
              example: text
            text:
              type: string
              example: Sélectionnez une option
          type:
            - object
            - 'null'
        body:
          properties:
            text:
              type: string
              example: Voici deux options
          type: object
        footer:
          properties:
            text:
              type: string
              example: Sélectionnez une option
          type:
            - string
            - 'null'
        buttons:
          type: array
          items:
            properties:
              id:
                type: string
                example: btn_1
              title:
                type: string
                example: Option 1
            type: object
        payment_detail:
          type: array
          items:
            properties:
              amount:
                type: number
                format: float
                example: '100'
              currency:
                type: string
                example: XAF
              order_id:
                type: string
                example: ORDER001
              callback_url:
                type: string
                example: https://shortext.ny-corp.io/callback
            type: object
        action:
          type: array
          items:
            properties:
              url:
                type: string
                example: https://shortext.ny-corp.io
            type: object
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      description: Basic Auth
      scheme: bearer

````