# Send a message

> Sends a text message as the connected person in one of their own conversations, a team chat or a patient conversation, and marks it as read for them. Set reply_to_message_id to reply in a thread. To message a patient by patient ID or phone number, use Send a message to a patient.

Source: https://www.bloomtext.com/developers/api/reference/create-message/

> Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth)

`POST /me/conversations/{conversationId}/messages`

Sends a text message as the connected person in one of their own conversations, a team chat or a patient conversation, and marks it as read for them. Set `reply_to_message_id` to reply in a thread. To message a patient by patient ID or phone number, use Send a message to a patient.

**Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key`

### Path parameters

- `conversationId` (UUID, required): ID of the conversation.

### Headers

- `Idempotency-Key` (UUID, required): A UUID you generate for each write. Retrying with the same key returns the original result for 24 hours. Reusing a key with a different method, path, or body returns 409.

### Body parameters

A text message. Sending files through the API isn't available yet.

- `body` (string, required): Message text, up to 10,000 characters.

- `reply_to_message_id` (UUID or null): Set to reply in a thread.

Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected).

### Returns

Returns `201 Created` with the [Message object](https://www.bloomtext.com/developers/api/reference/message-object/).

### Errors

Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint:

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | The request is malformed, such as invalid JSON. |
| 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. |
| 401 | `key_revoked` | The API key was revoked. |
| 401 | `key_expired` | The API key’s expiry has passed. |
| 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. |
| 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. |
| 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. |
| 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. |
| 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. |
| 422 | `validation_failed` | A field failed validation. See `field_errors`. |
| 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. |

```bash filename="Request"
curl -X POST "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages" \
  -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"body":"Friday at 9:00 works. You are all set."}'
```

```js filename="Request"
const response = await fetch('https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`,
    'Idempotency-Key': crypto.randomUUID(),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"body":"Friday at 9:00 works. You are all set."}),
})

if (!response.ok) throw new Error(`BloomText API error: ${response.status}`)
const data = await response.json()
```

```python filename="Request"
import os
import uuid

import requests

response = requests.post(
    "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages",
    headers={
        "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={"body":"Friday at 9:00 works. You are all set."},
)
response.raise_for_status()
data = response.json()
```

```go filename="Request"
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
	"os"

	"github.com/google/uuid"
)

func main() {
	body := bytes.NewBufferString(`{"body":"Friday at 9:00 works. You are all set."}`)
	req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN"))
	req.Header.Set("Idempotency-Key", uuid.NewString())
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(res.Status, string(out))
}
```

```ruby filename="Request"
require "net/http"
require "json"
require "securerandom"

uri = URI("https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}"
request["Idempotency-Key"] = SecureRandom.uuid
request["Content-Type"] = "application/json"
request.body = { body: "Friday at 9:00 works. You are all set." }.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end
data = JSON.parse(response.body)
```

```json filename="Response · 201 Created"
{
  "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1",
  "conversation": {
    "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0",
    "title": "Jane Doe"
  },
  "sender": {
    "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55",
    "name": "Dr. Example",
    "kind": "staff"
  },
  "patient": {
    "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77",
    "name": "Jane Doe"
  },
  "channel": "sms",
  "phone_number": {
    "number": "+15125550100",
    "team": "Front desk"
  },
  "delivery": {
    "status": "queued",
    "error": null,
    "updated_at": "2026-09-21T15:04:05Z"
  },
  "campaign_id": null,
  "created_at": "2026-09-21T15:04:05Z",
  "edited_at": null,
  "type": "text",
  "body": "Friday at 9:00 works. You are all set.",
  "file": null,
  "reply_to_message_id": null,
  "unread": false,
  "sent_via": {
    "client_id": "bt_client_7Hq2mX9aLk",
    "name": "Acme EHR Assistant"
  }
}
```
