# Create a message

You can create a message that has been initiated by an admin. The conversation can be either an in-app message or an email.

> 🚧 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.

Endpoint: POST /messages
Version: 2.15
Security: bearerAuth

## Header parameters:

  - `Intercom-Version` (string)
    Intercom API version.By default, it's equal to the version set in the app package.
    Enum: "1.0", "1.1", "1.2", "1.3", "1.4", "2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14"

## Request fields (application/json):

  - `message_type` (string)
    The kind of message being created. Values: in_app or email.
    Enum: "in_app", "email"

  - `subject` (string)
    The title of the email.
    Example: "Thanks for everything"

  - `body` (string)
    The content of the message. HTML and plaintext are supported.
    Example: "Hello there"

  - `template` (string)
    The style of the outgoing message. Possible values plain or personal.
    Example: "plain"

  - `from` (object)
    The sender of the message. If not provided, the default sender will be used.

  - `from.type` (string, required)
    Always admin.
    Enum: "admin"

  - `from.id` (integer, required)
    The identifier for the admin which is given by Intercom.
    Example: 394051

  - `to` (any)

  - `cc` (any)

  - `bcc` (any)

  - `created_at` (integer)
    The time the message was created. If not provided, the current time will be used.
    Example: 1590000000

  - `create_conversation_without_contact_reply` (boolean)
    Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided.
    Example: true

## 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 or twitter.
    Enum: "email", "inapp", "facebook", "twitter"

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

## Response 400 fields (application/json):

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

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

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

  - `errors.code` (string, required)
    A string indicating the kind of error, used to further qualify the HTTP response code
    Example: "unauthorized"

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

  - `errors.field` (string,null)
    Optional. Used to identify a particular field or query parameter that was in error.
    Example: "email"


