PostMessage¶
Posts a new message to a channel.
1 | |
Parameters¶
string channelId
The ID of the channel to post the message to.
ChannelMessage msg
The message properties.
Returns¶
A ChannelMessageResult instance containing the results of the operation.
Remarks¶
This method performs different actions depending on whether the given input has an Id property:
- If no
Idis specified, it simply posts a new activity message on the channel with the given subject and content. This is useful for notification purposes. - When an
Idis given, the method first checks if a message with the specifiedIdwas previously sent on the channel. If a previously sent message is found, it does not create a new activity and returns the existing Case instance. - If the input contains a
referencesproperty, it also checks for previously sent messages with the referenced IDs. If any reference is found, it creates a new activity that is linked to the matching case and returns the existing Case instance. - When nothing matches, it creates a new Case on the channel with the activity and returns it.
- If case management is not enabled on the channel, it always posts a new activity on the channel without a Case instance.
The channel must resolve in the current domain and msg must be a JavaScript object. Posting is a state-changing channel operation. The returned IsNew is false when the channel recognizes an already processed message; Case and Id are present only when the processing result includes them.
Create an activity¶
1 2 3 4 | |
Create a case¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |