Send a message to a patient
/patient-messagesSends a message to a patient by patient_id or phone number. With OAuth it’s sent as the connected admin, and their conversation is marked as read; with an API key it’s sent as the key, like “Reminder service”. BloomText finds the patient (or creates one for a new phone number), finds or starts the conversation on the phone number, and sends. Messages go by secure link unless channel is sms.
Headers
Idempotency-KeyUUIDRequiredA 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 message to a patient.
toRecipientRequiredWho to message. Provide exactly one of patient_id or phone.
Show child attributes
patient_idUUIDThe patient to message.
phonestringA mobile number. BloomText finds the patient with this number, or creates one.
patientPatientDetailsDetails for a patient BloomText creates while sending. Ignored when the phone number matches an existing patient.
Show child attributes
first_namestringFirst name.
last_namestringLast name.
date_of_birthdateDate of birth.
emailstringEmail address.
mrnstringThe patient’s ID in your system.
bodystringRequiredMessage text, up to 1,600 characters.
channelsecure, smssecure (the default) sends a text or email with a secure link, and the message stays in BloomText. sms sends the text itself as a regular SMS.
fromstringThe clinic phone number to send from, in E.164 format, like +15125550100. Defaults to the default number: the one set on the API key, or the admin’s own. See List phone numbers.
Returns
Returns 201 Created with the sent Message object in message, plus patient_created and conversation_created to say whether BloomText created either one.
Errors
Failed requests return application/problem+json problem details. 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 or access token is missing, expired, or revoked. |
| 403 | insufficient_scope | The credential doesn’t have the scope this endpoint needs. |
| 404 | not_found | The patient_id doesn’t exist in the organization, or from isn’t one of its phone numbers. |
| 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. |
| 409 | ambiguous_recipient | The phone number belongs to more than one patient. candidates lists them; send again with a patient_id, or add patient.mrn. |
| 422 | validation_failed | A field failed validation. See field_errors. |
| 422 | from_required | There are several phone numbers and no default. Pass from; see List phone numbers. |
| 422 | no_contact_method | The patient has no phone number for sms, or no phone or email for secure. |
| 422 | patient_opted_out | The patient replied STOP to texts from this number. Send with secure by email, or wait for them to reply START. |
| 429 | rate_limited | Too many requests. Retry after Retry-After seconds. |