# Invalid request body format when trying to reply to user. chatbot app

**URL:** <https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251>\
**Category:** Chat\
**Created:** [January 11, 2023, 9:19am UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251 "2023-01-11T09:19:30Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![anto1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anto1](https://devforum.zoom.us/u/anto1)\
**Post date:** [January 11, 2023, 9:19am UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/1 "2023-01-11T09:19:30Z")

</div>

**Zoom Apps Configuration**

Ruby on Rails

**Description**

No matter what I try, I always get a BadRequest reply from the server when replying to a message from our chatbot. Never have managed to make it work.

**Error?**

RestClient::BadRequest (400 Bad Request)

and on Postman:

{  
“code”: 7001,  
“message”: “Invalid request body format.”,  
“result”: false  
}

**Troubleshooting Routes**

- I added all the info to have a publishable URL, which is apparently needed to use production client id and secret.
- I tested locally and on postman.

**How To Reproduce**

1. Have a user ask something to the chatbot
2. Upon request reception, access\_token is properly obtained
3. when sending reply, I get the bad request message. This is the method

def send\_chat(chatbot\_token)  
url = ‘[https://api.zoom.us/v2/im/chat/messages](https://api.zoom.us/v2/im/chat/messages)’

```
body = {
    'robot_jid': Lalip::Application.credentials.dig(:zoom_app,:bot_jid),
    'to_jid': params[:payload][:toJid],
    'account_id': params[:payload][:accountId],
    'content': {
      'head': {
        'text': 'Your rewritten feedback:'
      },
      'body': [{
        'type': 'message',
        'text': "you said #{params[:payload][:cmd]}"
      }]
    }
  }
  headers = {
    'Content-Type': 'application/json',
    'Authorization': "Bearer #{chatbot_token}"
  }
  response = RestClient.post url, body.to_json, headers
  if response.code == 200
    Rails.logger.debug(response.body)
  else
    Rails.logger.error("Error sending chat. #{response.body}")
  end
end

```

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [January 11, 2023, 10:50pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/2 "2023-01-11T22:50:59Z")

</div>

Welcome 😃

Thank you for posting in the Zoom Developer Forum, @anto1 ! To begin, can you confirm if you are encountering this issue only when making a request using Ruby? Have you attempted to make the request in a different programming language or using a tool like Postman? You should also know, Postman can also help with formatting issues as it generates code snippets for each entered request.

---

<div class="post-metadata">

**Author:** ![anto1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anto1](https://devforum.zoom.us/u/anto1)\
**Post date:** [January 12, 2023, 8:11am UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/3 "2023-01-12T08:11:42Z")

</div>

Hello,

The issue is the same with postman. I copied the error i got from postman o the request!

---

<div class="post-metadata">

**Author:** ![anto1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anto1](https://devforum.zoom.us/u/anto1)\
**Post date:** [January 12, 2023, 10:20am UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/4 "2023-01-12T10:20:35Z")

</div>

I just realized that on this page:

[https://marketplace.zoom.us/docs/guides/chatbots/send-edit-and-delete-messages/](https://marketplace.zoom.us/docs/guides/chatbots/send-edit-and-delete-messages/)

You mark the " `user_jid`" as required. But I do not know my user\_jid.

Is this the issue?

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [January 12, 2023, 2:08pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/5 "2023-01-12T14:08:52Z")

</div>

@anto1 ,

That may an issue but I do not think it will resolve the Invalid request body format error. This error means you sent data in the incorrect format. I’d recommend using a tool like postman to test making a successful request. I see you used postman and were not successful, can you a share screenshot of how you set up the request?

---

<div class="post-metadata">

**Author:** ![anto1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anto1](https://devforum.zoom.us/u/anto1)\
**Post date:** [January 12, 2023, 3:03pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/6 "2023-01-12T15:03:20Z")

</div>

Sure.

I send a message to the chatbot from zoom. The access token gets created on my server. I take that token and paste it on postman, and add the production jbot id, plus account id and to\_jid. Attached three screenshots: the (successful) authorization request, followed by the headers of the send message request and the body + result of the request. Clicking the image will show you the three images

[[Album] Imgur: The magic of the Internet ![](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/b/3/b3a928b612f09b07795c8fdf279e03cb40925a91.jpeg "Imgur: The magic of the Internet") ](https://imgur.com/a/fdbZomz)

---

<div class="post-metadata">

**Author:** ![anto1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anto1](https://devforum.zoom.us/u/anto1)\
**Post date:** [January 18, 2023, 4:53pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/7 "2023-01-18T16:53:28Z")

</div>

Any updates? Thanks!

---

<div class="post-metadata">

**Author:** ![anto1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anto1](https://devforum.zoom.us/u/anto1)\
**Post date:** [January 24, 2023, 1:52pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/8 "2023-01-24T13:52:55Z")

</div>

still waiting! what else can i try?

---

<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:** [January 24, 2023, 2:47pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/9 "2023-01-24T14:47:38Z")

</div>

Hi @anto1  
I recently saw a similar issue in the forum, which was resolved by adding the “user\_jid” field in the request body

> [@Chatbot im/chat/messages error](https://devforum.zoom.us/t/chatbot-im-chat-messages-error/81950):
>
> API Endpoint(s) and/or Zoom API Event(s) /v2/im/chat/messages Description Not able to get this api to work with my chatbot token. Testing it from postman. Pass in the correct headers of: Authorization: Bearer ey… Content-Type: application/json Body: (raw, json) { “account\_id”: “XXX”, “robot\_jid”: “[XXX@xmpp.zoom.us](mailto:XXX@xmpp.zoom.us)”, “to\_jid”: “[XXX@xmpp.zoom.us](mailto:XXX@xmpp.zoom.us)”, “content”: { “head”: { “text”: “test” } } } Error? { “code”: 500, “message”: “Invalid request body format.”, “result”: false }

Can you please give this a try and let me know?  
Best,  
Elisa

---

<div class="post-metadata">

**Author:** ![anto1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anto1](https://devforum.zoom.us/u/anto1)\
**Post date:** [January 24, 2023, 5:13pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/10 "2023-01-24T17:13:09Z")

</div>

It worked. Thanks Elisa. Please update the documentation!

Anto

---

<div class="post-metadata">

**Author:** ![hkubov](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkubov/32/65008_2.png) [@hkubov](https://devforum.zoom.us/u/hkubov)\
**Post date:** [November 17, 2024, 8:40am UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/11 "2024-11-17T08:40:24Z")

</div>

The documentation page (the forum does not allow me to include links to your documentation, but it’s the page titled **Send, edit, and delete messages** in the **Guides** section, URL path /docs/team-chat-apps/send-edit-and-delete-messages/) says **Use the account\_id or the user\_jid not both**. Are you saying that we should indeed use both? But I am not sending a message on behalf of an individual user. It’s on behalf of a chatbot associated with my account.

I see our older apps are working fine, but when I try to test a new one with the same code on our side, I am getting this same error.

---

<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:** [December 6, 2024, 9:20pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/12 "2024-12-06T21:20:49Z")

</div>

Hi @hkubov  
could you please create a new topic and add as many details as possible about your issue?  
This topic has been solved so we have to move the conversation to a new one please

---

<div class="post-metadata">

**Author:** ![hkubov](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hkubov/32/65008_2.png) [@hkubov](https://devforum.zoom.us/u/hkubov)\
**Post date:** [December 8, 2024, 7:50pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/13 "2024-12-08T19:50:57Z")

</div>

I will not create a new topic because it’s the same problem and it’s barely resolved if your suggestion is to add `user_jid` in contradiction to your documentation. I think what’s missing (or maybe what I have missed) is an explanation that you should use `account_id` for Admin-managed apps and `user_jid` for User-managed apps

---

<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:** [December 10, 2024, 7:21pm UTC](https://devforum.zoom.us/t/invalid-request-body-format-when-trying-to-reply-to-user-chatbot-app/81251/14 "2024-12-10T19:21:46Z")

</div>

Thanks @hkubov  
I understand. Thank you for your feedback and I will pass it down to our team
