# Create a message

You can create a message that has been initiated by an admin. The conversation can be either an in-app message, an email or whatsapp.
> 🚧 Sending for visitors
There can be a short delay between when a contact is created and when a contact becomes available to be messaged through the API. A 404 Not Found error will be returned in this case.

This will return the Message model that has been created.
> 🚧 Retrieving Associated Conversations
As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message.

`from` should be an admin. A request with a user or lead as `from` is not rejected: it creates a conversation initiated by that contact, as the Create a conversation endpoint (`POST /conversations`) does, and the `to`, `cc` and `bcc` fields are ignored. To create a conversation initiated by a contact, use `POST /conversations`.

Endpoint: POST /messages
Version: 2.17
Security: bearerAuth

## Header parameters:

  - `Intercom-Version` (string)

## Response 200 fields (application/json):

  - `type` (string, required)
    The type of the message
    Example: user_message

  - `id` (string, required)
    The id representing the message.
    Example: 1488971108

  - `created_at` (integer, required)
    The time the conversation was created.
    Example: 1667560812

  - `subject` (string)
    The subject of the message. Only present if message_type: email.
    Example: Greetings

  - `body` (string, required)
    The message body, which may contain HTML.
    Example: Hello

  - `message_type` (string, required)
    The type of message that was sent. Can be email, inapp, facebook, twitter or whatsapp.
    Enum: "email", "inapp", "facebook", "twitter", "whatsapp"

  - `conversation_id` (string)
    The associated conversation_id
    Example: 64619700005570

  - `owner` (object)
    Admins are teammate accounts that have access to a workspace.

  - `owner.type` (string)
    String representing the object's type. Always has the value `admin`.
    Example: admin

  - `owner.id` (string)
    The id representing the admin.
    Example: 1295

  - `owner.name` (string)
    The name of the admin.
    Example: Joe Example

  - `owner.email` (string)
    The email of the admin.
    Example: jdoe@example.com

  - `owner.job_title` (string)
    The job title of the admin.
    Example: Associate

  - `owner.away_mode_enabled` (boolean)
    Identifies if this admin is currently set in away mode.
    Example: false

  - `owner.away_mode_reassign` (boolean)
    Identifies if this admin is set to automatically reassign new conversations to the apps default inbox.
    Example: false

  - `owner.away_status_reason_id` (integer)
    The unique identifier of the away status reason. Not returned by List all admins.
    Example: 12345

  - `owner.has_inbox_seat` (boolean)
    Identifies if this admin has a paid inbox seat to restrict/allow features that require them.
    Example: true

  - `owner.team_ids` (array)
    The ids of the teams the admin belongs to. When the workspace has a default team, its id is the last item.
    Example: [814865]

  - `owner.avatar` (object)
    The teammate's avatar image. On List all admins it is only included when `display_avatar` is `true`. Elsewhere it is left out when the teammate has neither an uploaded avatar nor a gravatar.

  - `owner.avatar.type` (string)
    Value is `avatar`. Returned by List all admins only.
    Example: avatar

  - `owner.avatar.image_url` (string)
    The URL of the avatar image.
    Example: https://picsum.photos/200/300

  - `owner.team_priority_level` (object)
    Admin priority levels for teams

  - `owner.team_priority_level.primary_team_ids` (array)
    The primary team ids for the team
    Example: [814865]

  - `owner.team_priority_level.secondary_team_ids` (array)
    The secondary team ids for the team
    Example: [493881]

  - `owner.role` (object)
    The role assigned to this admin. Only present if the admin has a role assigned.

  - `owner.role.type` (string)
    String representing the object's type. Always has the value `role`.
    Example: role

  - `owner.role.id` (string)
    The id of the role.
    Example: 1

  - `owner.role.name` (string)
    The name of the role.
    Example: Support Agent

  - `template` (string)
    The style of the email, such as `plain` or `personal`. Only present when `message_type` is `email`.
    Example: plain

  - `external_id` (string)
    The external identifier of the message, if one was set when the message was created. Only returned for messages started by a contact.
    Example: api:order-1234

  - `whatsapp_message_id` (string)
    The id WhatsApp gave the message. Only present for `whatsapp` messages that WhatsApp accepted.
    Example: wamid.EXAMPLE123

## Response 400 fields (application/json):

  - `type` (string, required)
    The type is error.list
    Example: error.list

  - `request_id` (string)
    Example: f93ecfa8-d08a-4325-8694-89aeb89c8f85

  - `errors` (array, required)
    An array of one or more error objects

  - `errors.code` (any, required)
    A string indicating the kind of error, used to further qualify the HTTP response code. A few request validation errors send an HTTP status code as an integer here instead, for example `422`.
    Example: unauthorized

  - `errors.message` (string)
    Optional. Human readable description of the error.
    Example: Access Token Invalid

## Response 401 fields (application/json):

  - `type` (string, required)
    The type is error.list
    Example: error.list

  - `request_id` (string)
    Example: f93ecfa8-d08a-4325-8694-89aeb89c8f85

  - `errors` (array, required)
    An array of one or more error objects

  - `errors.code` (any, required)
    A string indicating the kind of error, used to further qualify the HTTP response code. A few request validation errors send an HTTP status code as an integer here instead, for example `422`.
    Example: unauthorized

  - `errors.message` (string)
    Optional. Human readable description of the error.
    Example: Access Token Invalid

## Response 403 fields (application/json):

  - `type` (string, required)
    The type is error.list
    Example: error.list

  - `request_id` (string)
    Example: f93ecfa8-d08a-4325-8694-89aeb89c8f85

  - `errors` (array, required)
    An array of one or more error objects

  - `errors.code` (any, required)
    A string indicating the kind of error, used to further qualify the HTTP response code. A few request validation errors send an HTTP status code as an integer here instead, for example `422`.
    Example: unauthorized

  - `errors.message` (string)
    Optional. Human readable description of the error.
    Example: Access Token Invalid

## Response 404 fields (application/json):

  - `type` (string, required)
    The type is error.list
    Example: error.list

  - `request_id` (string)
    Example: f93ecfa8-d08a-4325-8694-89aeb89c8f85

  - `errors` (array, required)
    An array of one or more error objects

  - `errors.code` (any, required)
    A string indicating the kind of error, used to further qualify the HTTP response code. A few request validation errors send an HTTP status code as an integer here instead, for example `422`.
    Example: unauthorized

  - `errors.message` (string)
    Optional. Human readable description of the error.
    Example: Access Token Invalid

## Response 422 fields (application/json):

  - `type` (string, required)
    The type is error.list
    Example: error.list

  - `request_id` (string)
    Example: f93ecfa8-d08a-4325-8694-89aeb89c8f85

  - `errors` (array, required)
    An array of one or more error objects

  - `errors.code` (any, required)
    A string indicating the kind of error, used to further qualify the HTTP response code. A few request validation errors send an HTTP status code as an integer here instead, for example `422`.
    Example: unauthorized

  - `errors.message` (string)
    Optional. Human readable description of the error.
    Example: Access Token Invalid

