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

# Send A Message

> To send a text message to a given telephone number or a contact
- **widget_id**: Widget ID to be used for initiating the call. It must be connected to WhatsApp or SMS.
- **to**: phone number of the recipient. should contain the country code. For ex: 16501111234 
- **contact_id**: contact ID to whom the message is to be sent. (either to or contact_id must be given)
- **message**: text message to be sent.
- **start_new_conversation**: whether to start a new conversation or pick the latest.



## OpenAPI

````yaml https://api.insighto.ai/api/v1/openapi.json post /api/v1/messaging/{widget_id}
openapi: 3.1.0
info:
  title: Ragify
  version: v1
servers: []
security: []
paths:
  /api/v1/messaging/{widget_id}:
    post:
      tags:
        - Messaging
      summary: Send A Message
      description: >-
        To send a text message to a given telephone number or a contact

        - **widget_id**: Widget ID to be used for initiating the call. It must
        be connected to WhatsApp or SMS.

        - **to**: phone number of the recipient. should contain the country
        code. For ex: 16501111234 

        - **contact_id**: contact ID to whom the message is to be sent. (either
        to or contact_id must be given)

        - **message**: text message to be sent.

        - **start_new_conversation**: whether to start a new conversation or
        pick the latest.
      operationId: send_a_message_api_v1_messaging__widget_id__post
      parameters:
        - name: widget_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Widget Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessagePayload'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Your API Key: []
        - HTTPBearer: []
components:
  schemas:
    SendMessagePayload:
      properties:
        to:
          anyOf:
            - type: string
            - type: 'null'
          title: To
        contact_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Contact Id
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
        start_new_conversation:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Start New Conversation
          default: true
        widget_parameters:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Widget Parameters
      type: object
      title: SendMessagePayload
      examples:
        - message: Hi, how are you?
          start_new_conversation: true
          to: '919810012345'
        - contact_id: 4d9f0116-ad43-4778-bbba-56e4f69783d6
          message: Hi, how are you?
          start_new_conversation: true
        - start_new_conversation: true
          to: '919810012345'
          widget_parameters:
            whatsapp:
              components:
                - parameters:
                    - text: John
                      type: text
                    - text: Laptop
                      type: text
                  type: body
              language_code: en_US
              template_name: new_order
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    Your API Key:
      type: apiKey
      description: >-
        Your API key for authentication. You can generate it from the
        **Settings** page. Format: starts with `in-`.
      in: query
      name: api_key
    HTTPBearer:
      type: http
      scheme: bearer

````