Skip to content

PostMessage

Posts a new message on channel

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

Parameters

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.

Create a activity

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

Create a case

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// 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 : Array<ChannelMessageAttachment>
Attachments of message

Content : string
Description of message. Optional. Same as Description.

Description : string
Description of message. Optional.

Id : string
Id of message. Optional. Any string with maximum 1024 characters.

References : Array
Array of references previously sent. Optional.

Subject : string
Subject of message. Optional.

ChannelMessageAttachment

displayName : string
Display name of attachment

ext : string
Extension of file if set to file type.

id : string
Id of attachment.

type : ( "file" | "url" )
Type of attachment.

url : string
Url of attachment

See Also