Using chat controller

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?


I’ve just tested this and it works.

Ensure that you are inMeeting before calling the sendChatMsgTo

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

@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?

@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);