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

# Update Conversation Messages

> Replaces the stored message turn history for a conversation, using the V3 [endpoints](/api-reference/v3/intro).

## Example Request

```json theme={null}
{
  "turns": [
    {
      "from": "human",
      "ts": 1699999999,
      "messages": [
        {
          "from": "human",
          "type": "text",
          "ts": 1699999999,
          "item": {
            "payload": {
              "message": "Hey, I need help with pricing."
            }
          }
        }
      ]
    }
  ],
  "updateConversationMetadata": true
}
```

<Note>
  This replaces the current conversation turn history stored in Firestore at `voiceglow/{agentId}/convos/{convoId}/convo/JSON_STRING`. It does **not** deliver anything to WhatsApp, Messenger, or other channels.
</Note>

<Tip>
  To send a real outbound message to the customer on their original channel, use [Send Message to Conversation](/api-reference/v3/conversations/send) instead.
</Tip>

<Tip>
  When `updateConversationMetadata` is true, the endpoint also refreshes `messagesNum`, `lastMessage`, `firstMessageTS`, `lastMessageTS`, and `lastModified` on the light conversation document.
</Tip>


## OpenAPI

````yaml PATCH /agents/{agentId}/convos/{convoId}/messages
openapi: 3.0.3
info:
  title: Convocore OpenAPI
  description: Full API reference for Convocore
  version: 1.0.4
servers:
  - url: https://eu-gcp-api.vg-stuff.com/v3
security: []
paths:
  /agents/{agentId}/convos/{convoId}/messages:
    patch:
      tags:
        - Conversations
      summary: Update Conversation Messages
      description: >-
        Replaces the stored conversation turn history for a conversation.
        Storage only  -  does not deliver to WhatsApp, Messenger, or other
        channels. To send a real outbound channel message, use POST
        /agents/{agentId}/convos/{convoId}/send.
      operationId: conversationRouter-updateAgentConvoMessages
      parameters:
        - name: agentId
          in: path
          required: true
          schema:
            type: string
        - name: convoId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                turns:
                  type: array
                  items:
                    $ref: '#/components/schemas/object_dc29d7f3'
                lgMessages:
                  type: array
                  items: {}
                updateConversationMetadata:
                  type: boolean
                  default: true
              required:
                - turns
              additionalProperties: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      agentId:
                        type: string
                      convoId:
                        type: string
                      turns:
                        type: array
                        items:
                          $ref: '#/components/schemas/object_dc29d7f3'
                      messagesNum:
                        type: number
                      lastMessage:
                        type: string
                      firstMessageTS:
                        type: number
                      lastMessageTS:
                        type: number
                      updatedAt:
                        type: number
                    required:
                      - agentId
                      - convoId
                      - turns
                      - messagesNum
                      - updatedAt
                    additionalProperties: false
                required:
                  - success
                  - message
                  - data
                additionalProperties: false
        default:
          $ref: '#/components/responses/error'
      security:
        - Authorization: []
components:
  schemas:
    object_dc29d7f3:
      type: object
      properties:
        from:
          type: string
          enum:
            - system
            - bot
            - human
        messages:
          type: array
          items:
            $ref: '#/components/schemas/object_2aee7e16'
        ts:
          type: number
        session_id:
          type: string
        isAIGenerated:
          type: boolean
        modelId:
          type: string
        sources:
          type: array
          items:
            type: object
            additionalProperties: {}
        langchainMessages:
          type: array
          items:
            type: object
            additionalProperties: {}
      required:
        - from
        - messages
      additionalProperties: true
    object_2aee7e16:
      type: object
      properties:
        mid:
          type: string
        from:
          type: string
          enum:
            - system
            - bot
            - human
        type:
          $ref: '#/components/schemas/string_964b20f2'
        item:
          $ref: '#/components/schemas/type_payload_time_3722fa'
        delay:
          type: number
        action:
          type: string
        ts:
          type: number
        feedback:
          type: boolean
        VGPayload:
          type: object
          additionalProperties: {}
        isLoading:
          type: boolean
        isAIGenerated:
          type: boolean
        sourceLabel:
          type: string
        placeholderImage:
          type: string
        mask:
          $ref: '#/components/schemas/messageIndex_turnIndex_7192be'
        sendError:
          $ref: '#/components/schemas/message_ts_0a99cb'
        replyTo:
          $ref: >-
            #/components/schemas/messageId_messageContent_messageFrom_messageIndex_58de36
      required:
        - type
      additionalProperties: true
    message_11569e:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      additionalProperties: false
    string_964b20f2:
      type: string
      enum:
        - launch
        - text
        - choice
        - MultiSelect
        - cardV2
        - carousel
        - visual
        - GetBrowserData
        - Embed
        - location
        - iFrame
        - FileUpload
        - MultiFileUpload
        - GoogleForm
        - EmailForm
        - SetConvoData
        - VoiceNote
        - SetRuntime
        - no-reply
        - VGVF_Channel
        - VFVG_Channel
        - VG_Response
        - knowledgeBase
        - jsx
        - Flowise
        - MultiDropdown
        - Slider
        - Attachment
        - info:default
        - info:success
        - info:danger
        - info:primary
        - end
        - debug
        - stealth
        - debug:success
        - debug:error
        - debug:tell
        - context:form_submission
        - file
        - browser_capture
    type_payload_time_3722fa:
      type: object
      properties:
        type:
          type: string
        payload:
          $ref: '#/components/schemas/S_9a8008a0'
        time:
          type: number
      additionalProperties: true
    messageIndex_turnIndex_7192be:
      type: object
      properties:
        messageIndex:
          type: number
        turnIndex:
          type: number
      additionalProperties: false
    message_ts_0a99cb:
      type: object
      properties:
        message:
          type: string
        ts:
          type: number
      required:
        - message
        - ts
      additionalProperties: false
    messageId_messageContent_messageFrom_messageIndex_58de36:
      type: object
      properties:
        messageId:
          type: string
        messageContent:
          type: string
        messageFrom:
          type: string
        messageIndex:
          type: number
        turnIndex:
          type: number
      required:
        - messageId
        - messageContent
        - messageFrom
        - messageIndex
        - turnIndex
      additionalProperties: false
    S_9a8008a0:
      anyOf:
        - $ref: '#/components/schemas/message_941749'
        - $ref: '#/components/schemas/buttons_4b7232'
        - $ref: '#/components/schemas/image_imageUrl_0e21de'
        - $ref: '#/components/schemas/title_description_imageUrl_buttons_487555'
        - $ref: '#/components/schemas/cards_e76781'
        - $ref: '#/components/schemas/url_layout_a74cb0'
        - $ref: '#/components/schemas/url_ts_kind_width_ac1137'
        - type: string
        - type: number
        - type: boolean
        - type: array
          items: {}
        - type: object
          additionalProperties: {}
    message_941749:
      type: object
      properties:
        message:
          type: string
      additionalProperties: true
    buttons_4b7232:
      type: object
      properties:
        buttons:
          type: array
          items:
            $ref: '#/components/schemas/name_request_8bc9ee'
      required:
        - buttons
      additionalProperties: true
    image_imageUrl_0e21de:
      type: object
      properties:
        image:
          type: string
        imageUrl:
          type: string
      additionalProperties: true
    title_description_imageUrl_buttons_487555:
      type: object
      properties:
        title:
          type: string
        description:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/text_434f6e'
        imageUrl:
          type: string
        buttons:
          type: array
          items:
            $ref: '#/components/schemas/name_request_8bc9ee'
      additionalProperties: true
    cards_e76781:
      type: object
      properties:
        cards:
          $ref: '#/components/schemas/array_decb1ace'
      required:
        - cards
      additionalProperties: true
    url_layout_a74cb0:
      type: object
      properties:
        url:
          type: string
        layout:
          type: string
          enum:
            - vertical
            - horizontal
      required:
        - url
      additionalProperties: true
    url_ts_kind_width_ac1137:
      type: object
      properties:
        url:
          type: string
        ts:
          type: number
        kind:
          type: string
          enum:
            - screenshot
            - screenshare_frame
        width:
          type: number
        height:
          type: number
      required:
        - url
      additionalProperties: true
    name_request_8bc9ee:
      type: object
      properties:
        name:
          type: string
        request:
          $ref: '#/components/schemas/S_18860fad'
      required:
        - name
        - request
      additionalProperties: true
    text_434f6e:
      type: object
      properties:
        text:
          type: string
      required:
        - text
      additionalProperties: false
    array_decb1ace:
      type: array
      items:
        $ref: '#/components/schemas/title_description_imageUrl_buttons_487555'
    S_18860fad:
      anyOf:
        - $ref: '#/components/schemas/type_payload_d5824c'
        - $ref: '#/components/schemas/type_payload_565f92'
    type_payload_d5824c:
      type: object
      properties:
        type:
          type: string
          enum:
            - open_url
        payload:
          $ref: '#/components/schemas/url_c88218'
      required:
        - type
        - payload
      additionalProperties: false
    type_payload_565f92:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
        payload:
          $ref: '#/components/schemas/message_11569e'
      required:
        - type
        - payload
      additionalProperties: false
    url_c88218:
      type: object
      properties:
        url:
          type: string
      required:
        - url
      additionalProperties: false
  responses:
    error:
      description: Error response
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
              code:
                type: string
              issues:
                type: array
                items:
                  $ref: '#/components/schemas/message_11569e'
            required:
              - message
              - code
            additionalProperties: false
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````