# Using chat controller

**URL:** <https://devforum.zoom.us/t/using-chat-controller/93807>\
**Category:** Meeting SDK\
**Created:** [August 22, 2023, 10:11pm UTC](https://devforum.zoom.us/t/using-chat-controller/93807 "2023-08-22T22:11:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![randy](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@randy](https://devforum.zoom.us/u/randy)\
**Post date:** [August 22, 2023, 10:11pm UTC](https://devforum.zoom.us/t/using-chat-controller/93807/1 "2023-08-22T22:11:27Z")

</div>

I have a bot that joins a meeting - now I would like it to send a chat message to everyone. The code is really simple, and there is no error returned, but no message appears in the chat  
wchar\_t wide\_string = L’This is a test’;  
auto chatController = GetMeetingService()-\>GetMeetingChatController();  
SDKError err = chatController-\>SendChatMsgTo(&wide\_string, 0, ZOOM\_SDK\_NAMESPACE::SDKChatMessageType\_To\_All);

The return code is always SDKERR\_SUCCESS, but there is nothing in the chat window. What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [August 23, 2023, 2:36am UTC](https://devforum.zoom.us/t/using-chat-controller/93807/2 "2023-08-23T02:36:32Z")

</div>

@randy,

I’ve just tested this and it works.

Ensure that you are inMeeting before calling the sendChatMsgTo

```auto
    meetingchatcontroller = meetingService->GetMeetingChatController();
    wchar_t contentWideString = L'Hello, this is a chat message in wide string!';
    meetingchatcontroller->SendChatMsgTo(&contentWideString, 0, SDKChatMessageType_To_All);

```

---

<div class="post-metadata">

**Author:** ![randy](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@randy](https://devforum.zoom.us/u/randy)\
**Post date:** [August 23, 2023, 3:39pm UTC](https://devforum.zoom.us/t/using-chat-controller/93807/3 "2023-08-23T15:39:52Z")

</div>

@chunsiong.zoom Thank you, for some reason the same code almost works today. The issue is that the text comes through as a garbled string(H賽翽). Is there an encoding I need to set?

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [August 24, 2023, 2:24am UTC](https://devforum.zoom.us/t/using-chat-controller/93807/4 "2023-08-24T02:24:36Z")

</div>

> [@chunsiong.zoom](#):
>
> ` meetingchatcontroller = meetingService->GetMeetingChatController();`

@randy ,

something like this might work

```
std::wstring wstr = L"Hello, 世界!";
wchar_t wcharArray[1024]; // Choose an appropriate size
wcscpy_s(wcharArray, wstr.c_str());

meetingchatcontroller->SendChatMsgTo(wcharArray, 0, SDKChatMessageType_To_All);

```
