Editar

Compartir a través de


sendMessageToConversation

Omnichannel for Customer Service offers a suite of capabilities that extend the power of Dynamics 365 Customer Service Enterprise to enable organizations to instantly connect and engage with their customers across digital messaging channels. An additional license is required to access Omnichannel for Customer Service. For more information, see the Dynamics 365 Customer Service pricing overview and Dynamics 365 Customer Service pricing plan pages.

Use this method to send messages to a conversation.

Note

  • The conversation must be assigned to the agent that's logged in.
  • Only string literals and valid rich object JSON are currently supported. More information: Retrieve and format rich messages

Syntax

Microsoft.Omnichannel.sendMessageToConversation(message, toSendBox, conversationId);

Parameters

Parameter Type Description
message String or MessageObject Indicates the message to be sent to a conversation.
*toSendBox Boolean Determines if the message is sent to sendBox or directly to the conversation. Without providing this parameter, the message will be sent to sendbox by default.
*conversationId String Unique identifier of the conversation to which the message is to be sent. Also reffered to as liveworkitemId. Without providing this parameter, the message will send to the focused conversation by default.

* Indicates optional parameter.

Return value

Returns a resolved or rejected promise based on the outcome of the operation.

Example

// Sending message directly to the chat of conversation with provided conversationId
Microsoft.Omnichannel.sendMessageToConversation("Test message",  false, "00000000-0000-0000-0000-000000000000");
// Sending valid rich object to conversation
let validRichObjJSON = {
  "survey": {
    "Answers": {
      "Section": [
        {
          "Listitems": [
            {
              "OptionTitle": "Xbox Controller multi color",
              "OptionDescription": "Xbox Controller multi color",
              "OptionImageURL": "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RWwBPt?ver=d74f&w=270&h=222&q=90&m=6&p=48&b=%23FFFFFFFF&f=png&o=f&aim=true"
            }
          ],
          "SectionTitle": "XBox Controllers",
          "Multiselect": true
        }
      ],
      "Title": "Microsoft Xbox Controllers",
      "subtitle": "Choose a controller you like",
      "ImageURL": "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE2XP73?ver=7371&w=270&h=222&q=90&m=6&p=48&b=%23FFFFFFFF&f=png&o=f&aim=true",
      "ResponseMessage": "Thanks for choosing."
    }
  },
  "richObjectId": "00000000-0000-0000-0000-000000000000",
  "richObjectType": 192350002,
  "richObjectName": "Test with 0 guid",
  "tabKey": ""
}

Microsoft.Omnichannel.sendMessageToConversation(validRichObjJSON,  false);

Live chat SDK reference
Omnichannel JavaScript API reference
openConversation
getConversationId
linkToConversation
unlinkFromConversation
getConversations