Insert a Chat Message

NOTE: To insert a chat message, the connector must run with delegated permissions, and not as a service application. For more information, see Process Data from a Single User.

To insert a chat message, your XML must include the following properties and metadata fields:

Type Required Name Description
Property Yes Type The type of item to insert. To insert a chat message, specify ChatMessage.
Property

Set one of:

  • TEAMID and CHANNELID
  • CHATID
  • RECIPIENT
TEAMID The ID of the team that contains the channel.
Property CHANNELID The ID of the channel to insert the message into.
Property CHATID The ID of the chat to insert the message into.
Property RECIPIENT The recipient to send the message to. (The sender is the user who the connector is logged in as).
Metadata field Yes Content The message text.

For example, the value of your insertXML action parameter might look like this:

<insertXML>      
  <insert>
    <property name="Type" value="ChatMessage"/>
    <property name="RECIPIENT" value="alice@example.com"/>
    <xmlmetadata>
      <Content>Hi Alice. How are you?</Content>
    </xmlmetadata>
  </insert>
</insertXML>