sendChatToUser always returning 1

sendChatToUser is always returning 1 (error) when I try to programmatically send a chat message.

The following is the objective c code I used to send to all

[ms sendChatToUser:0 WithContent:@“Hi”]

@dev-admin-demo I think you have already got over this issue. Can you please help me if you know how to solve this?

Anybody who knows how to handle this please free to comment.

Hey @abu.thoppan,

Thanks for using the dev forum!

[ms sendChatToUser:0 WithContent:@“Hi”] returns an error because 0 is not a valid userID to send a chat message. In other places in the SDK, 0 represents the current user, but you cannot send a chat message to yourself. You have to obtain a userID of another user in the meeting then supply it to this function.

Thanks!
Michael

Thanks Michael! Will check that.

By the way is there any options to send to all participants at once?

You are welcome :slight_smile:

Yes there is. Instead of using sendChatToUser you would use sendChatToGroup. Then specify 0 in the first parameter:

[ms sendChatToGroup:0 WithContent:@“Hi”]

In this case, 0 represents all members in the chat group. If you did 1 instead, it would represent all the panelists.

Thanks!
Michael

Thank you so much. It worked!

1 Like

Hey @abu.thoppan,

Awesome! Let us know if you have any other questions.

Thanks!
Michael