The sendChatroomMessage API allows you to dynamically send messages to a particular chatroom.
sendChatroomMessage($to = 0,$message = '',$notsilent = 1)
1. By setting $notsilent to 1. A sample use would be to post a message on behalf of the user in a chatroom.(You can find out the chatroom ID from *CometChat Administration Panel* -> *Chatrooms*).
include_once ('cometchat/cometchat_init.php'); sendChatroomMessage ('1',"I love this site! I have already donated, have you?",1);
2. By setting $notsilent to 0 , the API returns the inserted Id (id of the message in database) of the message rather than posting a message in the chatroom. This should be used when a message needs some processing before being posted in the chatroom.
include_once ('cometchat/cometchat_init.php'); $insertedid = sendChatroomMessage ('1',"MESSAGE_THAT_REQUIRES_TO_BE_PROCESSED",0);
Not finding what you need?
The CometChat team is here to help!