# Get chat messages for a specific userId

**URL:** <https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833>\
**Category:** API and Webhooks\
**Created:** [September 10, 2020, 10:01pm UTC](https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833 "2020-09-10T22:01:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![szhang](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@szhang](https://devforum.zoom.us/u/szhang)\
**Post date:** [September 10, 2020, 10:01pm UTC](https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833/1 "2020-09-10T22:01:32Z")

</div>

If I have a Zoom userId, can I get all of the chat messages for this userId (including channel chat messages) ?  
I notice Zoom API provides the following:

1. GET /im/users/{userId}/chat/messages
2. GET /chat/users/{userId}/messages

For option 2 API, it looks I must provide to\_contact or to\_channel as request parameter. Does it mean if I want all chat messages for this userId, I need to get all contacts (and channels) firstly and then iterate them all ?  
For option 1 API, I wonder if I don’t provide chat\_user and channel parameters, will it return all of the messages for this userId ?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [September 10, 2020, 10:02pm UTC](https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833/2 "2020-09-10T22:02:17Z")

</div>

Hey @szhang

Thanks for posting on the Zoom Devforum! I am still learning, but I will try my best to help answer your question. 🙂

Checkout these related threads that may have the answer you are looking for:

> [@get the messages in a meeting](https://devforum.zoom.us/t/-/320):
>
> How can I get the messages I send in a meeting?

> [@Send chat messages via API](https://devforum.zoom.us/t/-/8524):
>
> We are evaluating Zoom against Webex Teams & MS Teams. We need to create incoming webhooks to post messages into chat channels. We have done this in all 3 products using the provided webhook apps (e.g. ‘Incoming Webhook’ app in Zoom Marketplace). Unfortunately, with Zoom, the notifications on messages sent via webhooks do not include any message content, just ‘app - incoming webhook’. So, the notifications aren’t very useful, unlike Webex/MS Teams, which show a preview of the message in the not…

If these threads did not help, please let us know by replying back here and someone from the Developer Relations team will get back to you shortly.

Thanks,  
DeveloperBot

---

<div class="post-metadata">

**Author:** ![szhang](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@szhang](https://devforum.zoom.us/u/szhang)\
**Post date:** [September 10, 2020, 10:03pm UTC](https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833/3 "2020-09-10T22:03:36Z")

</div>

It looks the recommended answers not apply to my case.

Thanks,

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 14, 2020, 8:00pm UTC](https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833/4 "2020-09-14T20:00:33Z")

</div>

Hi @szhang,

Thanks for reaching out about this—First, I just wanted to clarify that the first endpoint you referenced ([Retrieve IM Chat Messages](https://marketplace.zoom.us/docs/api-reference/zoom-api/im-chat/imchatmessages)) is being deprecated and will be removed from future versions, so I would not recommend utilizing this endpoint.

In regards to the 2nd endpoint (List User’s Chat Messages), I can confirm that you must provide either a `to_contact` OR a `to_channel parameter`. Without one of these, you will run into errors. To answer your question:

> Does it mean if I want all chat messages for this userId, I need to get all contacts (and channels) firstly and then iterate them all ?

That’s correct, if you want to list all messages for a given user, you’ll either need to do so based on the to\_contact or the to\_channel.

I hope this helps to clarify—let me know if you have any additional questions!

Best,  
Will

---

<div class="post-metadata">

**Author:** ![szhang](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@szhang](https://devforum.zoom.us/u/szhang)\
**Post date:** [September 14, 2020, 8:38pm UTC](https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833/5 "2020-09-14T20:38:52Z")

</div>

Thanks a lot for the clarification.

yes, I have seen Zoom API errors if I don’t provide to\_contact and to\_channel parameters on the 2nd endpoint which proves the API description. The same for the 1st endpoint.

Please refer to my recent post for similar questions on how to get contacts with UserIds.

> [@Get Zoom User's chat messages](https://devforum.zoom.us/t/get-zoom-users-chat-messages/30181):
>
> If I have several Zoom User’s UserId, with the description for Chat Messages\List User’s Chat Messages I must provide to\_contact parameter to get the chat messages with the contacts. I can find the API Contacts\List User’s Contacts However, this API can’t get contacts for each userId. Is there other ways that can be used to get all chat messages for some userIds ? Thank you!

[https://marketplace.zoom.us/docs/api-reference/zoom-api/contacts/getusercontacts](https://marketplace.zoom.us/docs/api-reference/zoom-api/contacts/getusercontacts)  
I am not sure how I can get a UserId’s contacts (with to\_contact parameter). It looks the endpoint can’t get contacts for each UserId.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 16, 2020, 5:25pm UTC](https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833/6 "2020-09-16T17:25:53Z")

</div>

Hi @szhang,

Thanks for clarifying! I’ll address this in this [thread](https://devforum.zoom.us/t/get-zoom-users-chat-messages/30181).

Best,  
Will

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [October 17, 2020, 3:25am UTC](https://devforum.zoom.us/t/get-chat-messages-for-a-specific-userid/29833/7 "2020-10-17T03:25:55Z")

</div>

Closed on October 17, 2020, 3:25am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
