# Unable to format chat message created via the API

**URL:** <https://devforum.zoom.us/t/unable-to-format-chat-message-created-via-the-api/94890>\
**Category:** Chat\
**Created:** [September 12, 2023, 12:55am UTC](https://devforum.zoom.us/t/unable-to-format-chat-message-created-via-the-api/94890 "2023-09-12T00:55:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sspeck](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@sspeck](https://devforum.zoom.us/u/sspeck)\
**Post date:** [September 12, 2023, 12:55am UTC](https://devforum.zoom.us/t/unable-to-format-chat-message-created-via-the-api/94890/1 "2023-09-12T00:55:00Z")

</div>

### Format Your New Topic as Follows:

**API Endpoint(s) and/or Zoom API Event(s)**  
_Link the API endpoint(s) and/orZoom API Event(s) you’re working with to help give context._  
/chat/users/{userId}/messages

**Description**  
_Details on your question, workflow or the problem you’re trying to solve._  
I’m able to successfully post a message to a channel, but it is missing the RichText objects that were present in the JSON request.

Here’s the request payload (with some information anonymized):  
{“rich\_text”:[{“end\_position”:4,“start\_position”:0,“format\_type”:“Bold”},{“end\_position”:54,“start\_position”:42,“format\_type”:“AddLink”,“format\_attr”:“[https://www.google.com/"}],“message”:"This](https://www.google.com/%22%7D%5D,%22message%22:%22This) is a test message. Here is a link to our website.”,“to\_channel”:“\<channel\_id\>”}

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [September 13, 2023, 12:36pm UTC](https://devforum.zoom.us/t/unable-to-format-chat-message-created-via-the-api/94890/2 "2023-09-13T12:36:54Z")

</div>

Hi @sspeck  
Thanks for reaching out to us!  
Allow me some time to do some testing on my end and I will get back to you with an update shortly

---

<div class="post-metadata">

**Author:** ![sspeck](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@sspeck](https://devforum.zoom.us/u/sspeck)\
**Post date:** [September 14, 2023, 4:21pm UTC](https://devforum.zoom.us/t/unable-to-format-chat-message-created-via-the-api/94890/3 "2023-09-14T16:21:03Z")

</div>

I have it figured out. There’s two failures going on:

- While `Bold` doesn’t have a `format_attr` that goes with it, the `format_attr` is apparently required for the object to successfully parse. This works if the `format_attr` value is set to an empty string (“”).
- The issue with the `AddLink` was that the position given fell outside the range of the string it was intended to format. The positions are 0-based, which is about what I’d expect. However, one quirk I’m noticing is that the `end_position` is the left “fence post” of the last character to receive the formatting, which seems to contradict the API documentation for `/chat/users/{userId}/messages`, which gives an example of formatting the first character only as 0, 1 (start and end positions respectively) instead of 0, 0 (which is the actual behavior).

Hopefully this will help others who run into this while working with the API.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [September 14, 2023, 7:15pm UTC](https://devforum.zoom.us/t/unable-to-format-chat-message-created-via-the-api/94890/4 "2023-09-14T19:15:37Z")

</div>

Thanks for sharing your findings with the community! @sspeck
