Documentation

Support

Vivox Core SDK

Vivox Core SDK

Send a directed message

Learn how to send direct messages between users.
Read time 1 minuteLast updated 20 hours ago

You can send a directed message by using ILoginSession.BeginSendDirectedMessage(AccountId userId, string message, AsyncCallback callback). This function creates and begins to send a directed message that contains a string message from the referenced ILoginSession to the target AccountId userId, and calls AsyncCallback on completion. Ensure that you use EndSendMessage on the ILoginSession within the AsyncCallback callback to finish sending the directed message and to check if the message send is successful. The following code snippet displays an example integration for BeginSendDirectedMessage.
var req = senderLoginSession.BeginSendDirectedMessage(targetAccount, message, ar =>{ vx_resp_account_send_message_t response; try { senderLoginSession.EndSendDirectedMessage(ar); } catch (System.Exception e) { Assert.Fail($"SendDirectedMessage threw {e}"); }});
BeginSendDirectedMessage also has an overload to allow for more specific information, which is available as IAsyncResult BeginSendDirectedMessage(AccountId userId, string language, string message, string applicationStanzaNamespace, string applicationStanzaBody, AsyncCallback callback).