---
updatedAt: 2025-01-08T23:23:30.000Z
agentTools:
  projectIndex: https://dev.frontapp.com/llms.txt
---

# createDraft

Open a composer with a new draft message.

```typescript Type
function createDraft(draft: object, cancelToken?: CancelToken): Promise<DraftMessage>;
```

## Parameters

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th style={{ textAlign: "left" }}>
        Parameter
      </th>

      <th style={{ textAlign: "left" }}>
        Type
      </th>

      <th style={{ textAlign: "left" }}>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td style={{ textAlign: "left" }}>
        `draft`
      </td>

      <td style={{ textAlign: "left" }}>
        Object
      </td>

      <td style={{ textAlign: "left" }}>
        Properties of the draft to create.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.channelId`
      </td>

      <td style={{ textAlign: "left" }}>
        String (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        ID of the channel to use to compose the draft.  If omitted, Front will apply its internal logic to pick the most relevant channel.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.to`
      </td>

      <td style={{ textAlign: "left" }}>
        Array of String (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        Handles to send the message to.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.cc`
      </td>

      <td style={{ textAlign: "left" }}>
        Array of String (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        Handles to add in copy of the message. Supported only for email channels.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.bcc`
      </td>

      <td style={{ textAlign: "left" }}>
        Array of String (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        Handles to add in blind copy of the message. Supported only for email channels.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.subject`
      </td>

      <td style={{ textAlign: "left" }}>
        String (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        Subject of the message.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.content`
      </td>

      <td style={{ textAlign: "left" }}>
        Object (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        Content properties of the draft.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.content.body`
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Content of the message.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.content.type`
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Content type of the body. Can be either `html` or `text`.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.attachments`
      </td>

      <td style={{ textAlign: "left" }}>
        Array of File (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        Files to attach to the message. Must contain absolute file paths.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.replyOptions`
      </td>

      <td style={{ textAlign: "left" }}>
        Object (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        Options to create a draft from another message.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.replyOptions.type`
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Type of the reply. Can be one of `reply`, `replyAll` or `forward`.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `draft.replyOptions.originalMessageId`
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        ID of the message to reply to or forward.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `cancelToken`
      </td>

      <td style={{ textAlign: "left" }}>
        [CancelToken](https://dev.frontapp.com/reference/plugin-sdk-cancel-token) (optional)
      </td>

      <td style={{ textAlign: "left" }}>
        Token to cancel the request.
      </td>
    </tr>
  </tbody>
</Table>

### Content type

The type of the `draft.content.body` property is defined in `draft.content.type`. It can be either `text` or `html`.\
Front will convert the content in a format that matches the teammate's composer preferences.

### Reply options

By default, `createDraft` will open a composer for a new message.\
To create a reply or forward a message, the function accepts an optional `draft.replyOptions` object. with a `originalMessageId` and a `type`. The `type` property can be one of:

* `reply` to reply to the sender of the original message. Front will address the message to the sender by default.
* `replyAll` to reply to all recipients of the original message. Front will reuse its recipients by default.
* `forward` to forward the original message. Front will reuse its content by default.

## Return value

The function returns a promise that resolves with the [Draft](https://dev.frontapp.com/reference/plugin-sdk-draft) created.

## Examples

```javascript Create a new message
const draft = await Front.createDraft({
  to: ['email@example.com'],
  content: {
    body: 'Hello world',
    type: 'text'
  }
});
```
```javascript Create a reply
const draft = await Front.createDraft({
  content: {
    body: 'Hello world',
    type: 'text'
  },
  replyOptions: {
    type: 'reply', // Or 'replyAll'
    originalMessageId: 'msg_xxx'
});
```
```javascript Create a forward
const draft = await Front.createDraft({
  replyOptions: {
    type: 'forward',
    originalMessageId: 'msg_xxx'
});
```