message.effect and text styles with text_decorations on a text part, both on follow-up messages sent with POST /v1/chats/{chat_id}/messages.
Send a message with an effect
Setmessage.effect to an object with a type and a name.
curl
Response (202)
name must be one of the names for its type. Anything else returns 400 VALIDATION_ERROR.
Know where effects work
Effects work on text-only follow-up messages in these chats:- Direct chats, on any service. You can leave
preferred_serviceout or set it to any value. Effects are delivered only over iMessage. If the message goes out as SMS or RCS, the text is still sent without the effect. Withpreferred_service: "iMessage", the message fails instead if it can’t go out as iMessage. - Established iMessage group chats. See Group chats.
400 FEATURE_NOT_ENABLED before anything is sent:
- An effect on a chat’s first message (
POST /v1/chats). - An effect on a message with a link, media or contact card part.
- An effect in a group that isn’t an established iMessage group.
Check whether the effect was delivered
Read the message withGET /v1/messages/{message_id}. effect shows what you asked for, and degradations lists anything that was dropped because the message went out as SMS or RCS. effect appears only on messages you sent with one; Blujay doesn’t report effects on messages your contacts send.
degradations is an empty array when nothing was dropped. Message webhooks carry the same entries.
Style text
Addtext_decorations to a text part. Each decoration has a range and a style:
rangeis[start, end)in UTF-16 code units:startis the first character to style andendis one past the last.endmust be greater thanstartand no greater than the text’s length, and a range can’t split a character that takes two UTF-16 code units, such as many emoji.styleisbold,italic,strikethroughorunderline.- A text part can have up to 100 decorations. Style ranges can overlap, so a word can be both bold and underlined.
curl
400 FEATURE_NOT_ENABLED before anything is sent:
- Styles on a chat’s first message.
- Styles in group chats, or in direct chats that aren’t iMessage.
- Styles on a message that also has a link, media or contact card part.
- Any decoration with
animationinstead ofstyle(see Limitations).
service on GET /v1/chats/{chat_id}, or send with preferred_service: "iMessage". See iMessage, RCS or SMS.
The checks above use the chat’s confirmed service. If a styled message in an iMessage chat still ends up going out as SMS or RCS, the text is sent without styling and degradations includes text_decorations_not_delivered.
Range problems, such as a range past the end of the text or a decoration with both style and animation, return 400 VALIDATION_ERROR.
Text styles are outbound only. When a contact sends you bold or italic text, the message’s text part carries the plain text with no text_decorations.
Limitations
- Text animations aren’t supported today. The API reference lists
animationnames (big,small,shake,nod,explode,ripple,bloom,jitter) in thetext_decorationsschema, but any decoration that usesanimationreturns400FEATURE_NOT_ENABLEDand nothing is sent. Usestyleonly. - Effects and styles are delivered over iMessage only. Over SMS or RCS the text goes out and
degradationsrecords what was dropped. - Text styles work in direct chats only (
400FEATURE_NOT_ENABLEDin groups). Effects in groups need an established iMessage group. See Group chats. - Neither works on a first message, on a message with a link, media or contact card, or before the contact has replied (
400FEATURE_NOT_ENABLED,400PRE_REPLY_CONTENT_BLOCKEDfor the file). See Sending rules. - Inbound effects and text styles aren’t reported. A contact’s slam or bold text arrives as plain text with no
effectand notext_decorations. - Up to 100 decorations per text part (
400VALIDATION_ERROR).
Next steps
iMessage, RCS or SMS
Control when a direct message goes out as iMessage, RCS or SMS.
Group chats
Learn what makes a group an established iMessage group.
Threaded replies
Reply to a specific message in its iMessage thread.
Track a message
Follow a message from
accepted to delivered or failed.