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

# Create a new Message

> Create a new Message

<Accordion title="Usage with the Drivly SDK" icon="code-simple">
  <Note>
    <span class="font-medium">Make sure you install our SDK first. You can find out how, and more [here](/commerce/sdk).</span>
  </Note>

  ```typescript theme={null}
  import { SDK } from '@drivly/commerce'
  import type { messages } from '@drivly/commerce'

  const sdk = new SDK(...)

  const messages = await sdk.messages.create(data: messages): Promise<messages>
  ```
</Accordion>


## OpenAPI

````yaml post /messages
openapi: 3.0.3
info:
  title: Drivly Commerce API
  version: 1.0.0
  description: API for the Driv.ly experience
  contact:
    name: Drivly
    url: https://driv.ly
    email: support@driv.ly
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://commerce.driv.ly/api
security: []
paths:
  /messages:
    post:
      tags:
        - messages
      summary: Create a new Message
      description: Create a new Message
      parameters:
        - name: depth
          in: query
          description: number of levels to automatically populate relationships and uploads
          schema:
            type: number
        - name: locale
          in: query
          description: retrieves document(s) in a specific locale
          schema:
            type: string
        - name: fallback-locale
          in: query
          description: specifies a fallback locale if no locale value exists
          schema:
            type: string
      requestBody:
        $ref: '#/components/requestBodies/messagesRequest'
      responses:
        '200':
          $ref: '#/components/responses/messagesUpsertConfirmationResponse'
      security:
        - apiKeyAuth: []
components:
  requestBodies:
    messagesRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/messages'
  responses:
    messagesUpsertConfirmationResponse:
      description: ok
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/messagesUpsertConfirmation'
  schemas:
    messages:
      additionalProperties: false
      title: Message
      type: object
      properties:
        status:
          enum:
            - Send
            - Sent
            - Received
            - Queued
            - Canceled
            - Retry
            - Manual
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
        lead:
          oneOf:
            - type: number
              nullable: true
            - additionalProperties: false
              title: Lead
              type: object
              properties:
                processStatuses:
                  enum:
                    - Qualified Lead
                    - Actively Communicating
                    - First Communication Attempt (phone and text)
                    - Second Communication Attempt
                    - On Hold
                    - Lost
                  type: string
                  nullable: true
                reason:
                  enum:
                    - Do Not Contact
                    - Duplicate
                    - Looking For Business Financing
                    - Looking For Listings
                    - Looking For Personal Financing
                    - Not Responding
                    - Test
                    - Bad Credit
                  type: string
                  nullable: true
                latestEvent:
                  type: number
                  nullable: true
                notes:
                  type: string
                  nullable: true
                statusTracker:
                  type: string
                  nullable: true
                searches:
                  items:
                    type: number
                  type: array
                  nullable: true
                attachments:
                  type: string
                  nullable: true
                firstName:
                  type: string
                  nullable: true
                lastName:
                  type: string
                  nullable: true
                phone:
                  type: string
                  nullable: true
                call:
                  type: string
                  nullable: true
                zipcode:
                  type: string
                  nullable: true
                email:
                  type: string
                  nullable: true
                loginEmail:
                  type: string
                  nullable: true
                purchaseOption:
                  type: string
                  nullable: true
                timeToPurchase:
                  items:
                    enum:
                      - ASAP
                      - This week
                      - Within 1-2 weeks
                      - Within 2-4 weeks
                      - Asap
                      - This Week
                      - Within 1-2 Weeks
                      - Within 2-4 Weeks
                      - within 1-2 weeks
                      - within 2-4 weeks
                      - within 1-2 months
                      - other
                      - this week
                      - asap
                      - 2+ months
                      - just browsing
                      - 1-2 months
                      - 1-2 weeks
                      - 2-4 weeks
                    type: string
                  type: array
                  nullable: true
                monthlyPayment:
                  type: number
                  nullable: true
                budgetLower:
                  type: string
                  nullable: true
                budgetUpper:
                  type: string
                  nullable: true
                mileageLower:
                  type: number
                  nullable: true
                mileageUpper:
                  type: number
                  nullable: true
                cashDown:
                  type: number
                  nullable: true
                newOrUsed:
                  type: string
                  nullable: true
                bodyStyle:
                  items:
                    enum:
                      - truck
                      - car
                      - van
                      - suv
                      - wagon
                    type: string
                  type: array
                  nullable: true
                carStyle:
                  items:
                    enum:
                      - sedan
                      - coupe
                      - convertible
                      - hatchback
                    type: string
                  type: array
                  nullable: true
                truckStyle:
                  items:
                    enum:
                      - crew
                      - reg
                      - extended
                    type: string
                  type: array
                  nullable: true
                suvStyle:
                  items:
                    enum:
                      - small/compact
                      - mid-size
                      - large/full-size
                    type: string
                  type: array
                  nullable: true
                vanStyle:
                  items:
                    enum:
                      - cargo
                      - passenger
                      - conversion
                    type: string
                  type: array
                  nullable: true
                yearLower:
                  type: number
                  nullable: true
                yearUpper:
                  type: number
                  nullable: true
                year:
                  type: number
                  nullable: true
                make:
                  type: string
                  nullable: true
                model:
                  type: string
                  nullable: true
                exterior:
                  items:
                    enum:
                      - Silver
                      - White
                      - Black
                      - Brown
                      - Blue
                      - Orange
                      - Red
                      - Green
                      - Any color
                      - Beige
                      - Gold
                      - Gray
                      - Light Blue
                    type: string
                  type: array
                  nullable: true
                interior:
                  items:
                    enum:
                      - Black
                      - Gray
                      - Tan
                      - Beige
                      - Blue
                      - Brown
                      - Red
                      - White
                      - Any color
                      - Ivory
                      - Cream
                    type: string
                  type: array
                  nullable: true
                fuelType:
                  items:
                    enum:
                      - Gasoline
                      - Electric
                      - Hybrid
                      - gasoline
                      - flex fuel
                      - diesel
                      - other
                      - hybrid
                      - electric
                    type: string
                  type: array
                  nullable: true
                drivetrain:
                  items:
                    enum:
                      - Four Wheel Drive
                      - Rear Wheel Drive
                      - Front Wheel Drive
                      - all wheel drive
                      - front wheel drive
                      - rear wheel drive
                    type: string
                  type: array
                  nullable: true
                transmission:
                  items:
                    enum:
                      - Automatic
                      - Manual
                      - automatic
                      - cvt
                      - manual
                    type: string
                  type: array
                  nullable: true
                comfort:
                  items:
                    enum:
                      - Leather/premium Seats
                      - Heated Steering Wheel
                      - leather/premium seats
                      - heated steering wheel
                      - ventilated or cooled seats
                      - heated seats
                      - dual-zone/climate control
                      - power-adjustable seats
                      - noise-cancelling technology
                      - massage seats
                    type: string
                  type: array
                  nullable: true
                safety:
                  items:
                    enum:
                      - Adaptive Cruise Control
                      - Blind Spot Monitor
                      - lane departure warning
                      - back up camera
                      - 360 camera
                      - park assist
                      - heads-up display
                      - adaptive cruise control
                      - blind spot monitor
                    type: string
                  type: array
                  nullable: true
                entertainment:
                  items:
                    enum:
                      - Premium Audio System
                      - Entertainment Package/dvd
                      - premium audio system
                      - apple carplay/android auto
                      - bluetooth
                      - auxiliary input
                      - usb ports
                      - wireless device charging
                      - wi-fi hotspot
                      - navigation system
                      - entertainment package/dvd
                      - satellite radio
                    type: string
                  type: array
                  nullable: true
                utility:
                  items:
                    enum:
                      - Towing Package
                      - Sunroof/moonroof/panoramic Roof
                      - towing package
                      - sunroof/moonroof/panoramic roof
                      - adaptive suspension
                      - 4 wheel drive
                      - 3rd row seats
                      - handicap accessible
                    type: string
                  type: array
                  nullable: true
                subscribe:
                  type: boolean
                  nullable: true
                agree:
                  type: boolean
                  nullable: true
                customer:
                  type: string
                  nullable: true
                messageNotifications:
                  type: boolean
                  nullable: true
                emailNotifications:
                  type: boolean
                  nullable: true
                emailAlerts:
                  type: boolean
                  nullable: true
                emailOffers:
                  type: boolean
                  nullable: true
                leadEvents:
                  items:
                    type: number
                  type: array
                  nullable: true
                cfZipcode:
                  type: string
                  nullable: true
                cfState:
                  type: string
                  nullable: true
                cfCity:
                  type: string
                  nullable: true
                completedDate:
                  type: string
                  nullable: true
                localTime:
                  type: string
                  nullable: true
                trade:
                  items:
                    type: number
                  type: array
                  nullable: true
                messages:
                  items:
                    type: number
                  type: array
                  nullable: true
                creditScore:
                  type: string
                  nullable: true
                contactScore:
                  type: string
                  nullable: true
                contactBelongsTo:
                  type: string
                  nullable: true
                contactType:
                  type: string
                  nullable: true
                contactValid:
                  type: boolean
                  nullable: true
                testingCustomer:
                  type: boolean
                  nullable: true
                estimatedAgeRange:
                  type: string
                  nullable: true
                estimatedAddress:
                  type: string
                  nullable: true
                estimatedZipcode:
                  type: string
                  nullable: true
                meetings:
                  items:
                    type: number
                  type: array
                  nullable: true
                makeAndModel:
                  type: string
                  nullable: true
                conversation:
                  type: string
                  nullable: true
                city:
                  type: string
                  nullable: true
                state:
                  type: string
                  nullable: true
                preApprovalId:
                  type: string
                  nullable: true
                vdpEmails:
                  items:
                    type: number
                  type: array
                  nullable: true
                favorites:
                  items:
                    type: number
                  type: array
                  nullable: true
                calls:
                  items:
                    type: number
                  type: array
                  nullable: true
                salesRep:
                  type: number
                  nullable: true
                preApprovals:
                  items:
                    type: number
                  type: array
                  nullable: true
                anonymousId:
                  type: string
                  nullable: true
                manual:
                  type: boolean
                  nullable: true
                trim:
                  type: string
                  nullable: true
                oneOwner:
                  type: boolean
                  nullable: true
                customers:
                  type: number
                  nullable: true
                updatedAt:
                  type: string
                createdAt:
                  type: string
              required:
                - id
                - updatedAt
                - createdAt
        template:
          oneOf:
            - type: number
              nullable: true
            - additionalProperties: false
              title: Template
              type: object
              properties:
                usedBy:
                  items:
                    type: number
                  type: array
                  nullable: true
                message:
                  type: string
                  nullable: true
                sequence:
                  type: number
                  nullable: true
                type:
                  enum:
                    - Email Sent
                    - Initial Text Message
                    - Text Nudge
                  type: string
                  nullable: true
                choice:
                  enum:
                    - A
                    - B
                    - C
                    - D
                    - E
                    - F
                    - G
                    - H
                    - I
                  type: string
                  nullable: true
                messages:
                  items:
                    type: number
                  type: array
                  nullable: true
                subject:
                  type: string
                  nullable: true
                updatedAt:
                  type: string
                createdAt:
                  type: string
              required:
                - id
                - updatedAt
                - createdAt
        createdTime:
          type: string
          nullable: true
        generated:
          type: boolean
          nullable: true
        type:
          type: string
          nullable: true
        openphoneMessageId:
          type: string
          nullable: true
        updatedAt:
          type: string
        createdAt:
          type: string
      required:
        - id
        - updatedAt
        - createdAt
    messagesUpsertConfirmation:
      type: object
      title: Message upsert confirmation
      properties:
        doc:
          additionalProperties: false
          title: Message
          type: object
          properties:
            status:
              enum:
                - Send
                - Sent
                - Received
                - Queued
                - Canceled
                - Retry
                - Manual
              type: string
              nullable: true
            message:
              type: string
              nullable: true
            phone:
              type: string
              nullable: true
            lead:
              type: number
              nullable: true
            template:
              type: number
              nullable: true
            createdTime:
              type: string
              nullable: true
            generated:
              type: boolean
              nullable: true
            type:
              type: string
              nullable: true
            openphoneMessageId:
              type: string
              nullable: true
            updatedAt:
              type: string
            createdAt:
              type: string
          required:
            - id
            - updatedAt
            - createdAt
        message:
          type: string
      required:
        - doc
        - message
  securitySchemes:
    apiKeyAuth:
      in: header
      type: apiKey
      name: Authorization

````