$Domain.PostMessage

Overview

Posts a new message on channel

ChannelMessageResult $Domain.PostMessage(channelId: string, msg: ChannelMessage)

Arguments

string channelId

Id of channel message to be posted

ChannelMessage msg

Message properties.

Remarks

This method performs different actions depending on whether the given input has an Id property.

If no Id specified, it just posts a new activity message on the channel with given subject and content. This method may be useful for notification purposes.

When input Id given, method first checks for specified Id previously sent on the channel. If a previously sent message found, does not create a new activity and returns existing Case instance.

If input contains references property, it also checks for previously sent messages with the referenced Ids. If any reference found, it creates a new activity that linked to the matching case and returns existing Case instance.

When nothing matches it creates a new Case on the channel with activity and returns.

If case management is not enabled on channel always posts a new activity on channel with no case instance.

Example

Create a activity

$Domain.PostMessage('22e8f630-aca2-4f55-ae25-138911190957', { subject : 'hello', description : 'hi team members' });

Example

Create a case

// first message to create case $Domain.PostMessage('22e8f630-aca2-4f55-ae25-138911190957', { id : 'first' subject : 'hello', description : 'hi team members' }); // continuation of case $Domain.PostMessage('22e8f630-aca2-4f55-ae25-138911190957', { id : 'second', references : ['first'], subject : 'hello again', description : 'second message of case' });

Types

ChannelMessage

{ // Attachments of message Attachments : Array<ChannelMessageAttachment> // Description of message. Optional. Same as Description. Content : string // Description of message. Optional. Description : string // Id of message. Optional. Any string with maximum 1024 characters. Id : string // Array of references previously sent. Optional. References : Array<string> // Subject of message. Optional. Subject : string }

ChannelMessageAttachment

{ // Display name of attachment displayName : string // Extension of file if set to file type. ext : string // Id of attachment. id : string // Type of attachment. type : ( "file" | "url" ) // Url of attachment url : string }

See Also

Copyright © 2010 - 2023 Emakin. All rights reserved.