---
updatedAt: 2026-06-25T13:42:02.000Z
agentTools:
  projectIndex: https://marketing.developer.dotdigital.com/llms.txt
---

# Sends a message to chat

<span class="callRateUnlimited"></span>

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Chat Message API",
    "description": "Provides methods for sending and retrieving messages within a chat session.\nSupports retrieval of chat events and message history from a given point in\ntime, sending new messages to a chat, and posting message status updates.",
    "version": "1.0.1"
  },
  "servers": [
    {
      "url": "https://{region}-api.dotdigital.com",
      "variables": {
        "region": {
          "description": "The Dotdigital region id your account belongs to",
          "enum": [
            "r1",
            "r2",
            "r3"
          ],
          "default": "r1"
        }
      }
    }
  ],
  "security": [
    {
      "basicAuth": []
    }
  ],
  "paths": {
    "/cpaas/chats/{chatId}/messages": {
      "post": {
        "summary": "Sends a message to chat",
        "parameters": [
          {
            "name": "chatId",
            "in": "path",
            "description": "The id of the chat",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Detail of the message to send",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessagePost"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The message was successfully sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagePostResult"
                }
              }
            }
          }
        },
        "x-codegen-request-body-name": "message"
      }
    }
  },
  "components": {
    "schemas": {
      "MessagePost": {
        "required": [
          "parts"
        ],
        "type": "object",
        "properties": {
          "from": {
            "$ref": "#/components/schemas/MessagePost_from"
          },
          "metadata": {
            "type": "object",
            "properties": {},
            "description": "Custom metadata relating to the message"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessagePart"
            }
          },
          "alert": {
            "$ref": "#/components/schemas/MessageAlert"
          },
          "direction": {
            "type": "string",
            "description": "Indicates the direction of the message",
            "enum": [
              "inbound",
              "outbound"
            ]
          },
          "isAutomatedSend": {
            "type": "boolean",
            "description": "Indicates if a message was an automated send - will be ommitted from analytics"
          }
        },
        "description": "Details of a message to post to the chat"
      },
      "MessagePostResult": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The globally unique id of the message"
          },
          "eventId": {
            "type": "integer",
            "description": "The id of the event corresponding to the send in the message stream for this chat"
          }
        },
        "description": "The id of the message sent event recorded"
      },
      "MessagePart": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "A name for the part"
          },
          "type": {
            "type": "string",
            "description": "The mime type (if applicable) sof the part"
          },
          "url": {
            "type": "string",
            "description": "A url associated with the message part"
          },
          "data": {
            "type": "string",
            "description": "String representation (e.g. base64) of the message part"
          },
          "size": {
            "type": "integer",
            "description": "Size of the message part in bytes"
          }
        },
        "description": "Details of a single part that makes up the message"
      },
      "MessageAlert": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Title for the notification to send to all platforms. Note that this is ignored if any details are set in platforms"
          },
          "body": {
            "type": "string",
            "description": "Body for the notification to send to all platforms. Note that this is ignored if any details are set in platforms"
          },
          "platforms": {
            "$ref": "#/components/schemas/MessageAlertPlatforms"
          }
        },
        "description": "Details of the alert to be displayed on receipt of the message"
      },
      "MessageAlertPlatforms": {
        "type": "object",
        "properties": {
          "apns": {
            "$ref": "#/components/schemas/MessageAlertApns"
          },
          "fcm": {
            "$ref": "#/components/schemas/MessageAlertFcm"
          }
        },
        "description": "The platform specific details for the alert. If specified, these are set verbatim and alert.title / alert.body values are ignored"
      },
      "MessageAlertApns": {
        "type": "object",
        "properties": {
          "badge": {
            "type": "integer",
            "description": "The value to display on the application badge"
          },
          "sound": {
            "type": "string",
            "description": "The soundfile to play on the device when the notification arrived"
          },
          "alert": {
            "type": "string",
            "description": "The alert to display on the device when the notification arrives"
          },
          "payload": {
            "type": "object",
            "properties": {},
            "description": "The payload to send to the device"
          }
        },
        "description": "The APNS details for the alert"
      },
      "MessageAlertFcm": {
        "type": "object",
        "properties": {
          "collapse_key": {
            "type": "string",
            "description": "The collapse key to send to FCM"
          },
          "data": {
            "type": "object",
            "properties": {},
            "description": "The payload to send to the device"
          },
          "notification": {
            "$ref": "#/components/schemas/MessageAlertFcmNotification"
          }
        },
        "description": "The FCM details for the alert"
      },
      "MessageAlertFcmNotification": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "The title to display"
          },
          "body": {
            "type": "string",
            "description": "The body to display"
          },
          "icon": {
            "type": "string",
            "description": "The icon to display"
          }
        },
        "description": "Details of the notification to display"
      },
      "MessagePost_from": {
        "required": [
          "profileId"
        ],
        "type": "object",
        "properties": {
          "profileId": {
            "type": "string",
            "description": "The id of the profile to send from"
          },
          "name": {
            "type": "string",
            "description": "Name to display"
          }
        },
        "description": "Set of identifiers for the message sender."
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "x-readme": {
    "samples-languages": [
      "curl",
      "csharp",
      "java",
      "node",
      "php",
      "python",
      "ruby"
    ],
    "explorer-enabled": true,
    "proxy-enabled": true,
    "samples-enabled": true
  }
}
```

# Sibling pages

* [Retrieves a chat's messages from an point (event) in time and works backwards](https://marketing.developer.dotdigital.com/reference/get_cpaas-chats-chatid-messages.md)