Skip to Content
API access is available to organizations with a signed BAA. Request API access →
API referenceSend a message to a patient

Send a message to a patient

POST/patient-messages

Sends a message to a patient by patient_id or phone number, from one of the organization’s numbers: from, else the key’s default number, else the organization’s only number. An organization with several numbers and no default answers 422 from_required. The message goes in that number’s team’s conversation with the patient, and comes from the API identity the key belongs to (an automated sender on the account, never a staff member); until identities are on for the account, it shows the key’s name with an API marker. BloomText finds the patient (or creates one for a new phone number), finds or starts the conversation, and sends. Messages go by secure link unless channel is sms.

Credentials
API key, or an OAuth access token
Scope
messages.write
Idempotent
With Idempotency-Key

Run in Postman: import the collection, set api_key, and find this request in its folder.

Query parameters

org_idUUID

The organization the call acts on, from List organizations. Required when an account API key reaches more than one organization; an organization key or a key limited to one organization can leave it out.

Headers

Idempotency-KeyUUIDRequired

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 message to a patient.

toRecipientRequired

Who to message. Provide exactly one of patient_id or phone.

Show child attributes
patient_idUUID

The patient to message.

phonestring

A mobile number. BloomText finds the patient with this number, or creates one.

patientPatientDetails

Details for a patient BloomText creates while sending. Ignored when the phone number matches an existing patient.

Show child attributes
first_namestring

First name.

last_namestring

Last name.

date_of_birthdate

Date of birth.

emailstring

Email address.

mrnstring

The patient’s ID in your system.

bodystringRequired

Message text: up to 1,600 characters for sms, or 40,000 for secure. A longer one returns 422 too_long.

channelsecure, smsRequired

Required; there’s no default. sms sends the text itself as a regular SMS from the clinic’s number. secure sends a text or email with a secure link, and the message stays in BloomText.

fromstring

The clinic phone number to send from, in E.164 format, like +15125550100. Defaults to the API key’s default number, else the organization’s only number; an organization with several numbers and no default answers 422 from_required. See List phone numbers.

Any other field returns 422 unknown_field. See Unknown fields are rejected.

Returns

Returns 201 Created with the sent Message object in message, plus patient_created and conversation_created to say whether BloomText created either one. Returns 202 Accepted with the same body when the message waits for the patient’s consent to texting, with delivery.status consent_requested.

Errors

Failed requests return application/problem+json problem details. The errors specific to this endpoint:

StatusCodeMeaning
400invalid_requestThe request is malformed, such as invalid JSON.
400org_id_requiredThe key reaches more than one organization: pass org_id.
401invalid_tokenThe API key is missing or malformed, or isn’t a BloomText key.
401key_revokedThe API key was revoked.
401key_expiredThe API key’s expiry has passed.
403insufficient_scopeThe key doesn’t have the scope this endpoint needs.
403org_not_reachableThe key can’t reach the organization in org_id.
403plan_requiredThe organization’s plan doesn’t include patient messaging.
404not_foundThe patient_id doesn’t exist in the organization, or from isn’t one of its phone numbers.
409idempotency_key_reusedThe Idempotency-Key was already used with a different request.
409idempotency_request_in_progressA request with this Idempotency-Key is still running. Retry shortly.
409ambiguous_recipientThe phone number belongs to more than one patient. candidates lists them; send again with a patient_id, or add patient.mrn.
409recipient_mismatchpatient.mrn belongs to a patient with a different phone number, or the number’s only patient has a different MRN. Nothing is sent. candidates lists that patient; update their phone, or send with their patient_id.
422validation_failedA field failed validation. See field_errors.
422from_requiredThe organization has several phone numbers and no default. detail and numbers list them; set from to one.
422channel_requiredchannel is missing. Set it to sms or secure; there’s no default.
422too_longThe body is over max characters (1,600 for sms, 40,000 for secure). length and max say by how much.
422patient_has_no_phoneAn sms send to a patient with no phone number.
422no_contact_methodA secure send to a patient with neither phone nor email.
422patient_opted_outThe patient opted out: they replied STOP to one of the organization’s numbers, or staff recorded their opt-out. No number can text them until they reply START. number and since say which number the text would have come from and since when.
422carrier_blockedThe carrier refused an earlier text to the patient because they replied STOP to that number, so the organization’s numbers don’t text them until they text START to one of them. number and since as above.
422number_blockedAn admin in your organization blocked the patient’s number. Only an admin can unblock it, in the app. number and since as above.
422number_unreachableAn earlier text failed because the patient’s number can’t receive texts: it’s a landline, or its carrier couldn’t be reached. It clears when the patient texts one of the organization’s numbers, when their phone number is changed, or when an admin clears it in the app. number and since as above.
429rate_limitedToo many requests. Retry after Retry-After seconds.
Last updated on