Unable to format chat message created via the API

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 is a test message. Here is a link to our website.”,“to_channel”:“<channel_id>”}

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

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.

Thanks for sharing your findings with the community! @sspeck