Invoke-Notification

Prev Next

Summary

Invoke a notification using a request type and an id. 

When items are created with a script, they are created "silently", meaning they are created without triggering any notifications or events. It is designed this way so scripts can perform many actions without clogging up the notification system. This utility is useful when you, for example, do want to specifically send a notification based on a certain request type, such as creating a new task or issuing a mention to someone. Please do note, though, that there are safety mechanisms in place that prevent too many notifications from being triggered at once.

Invoke-Notification    
    -RequestType
    -Id

Returns nothing.

Parameters

Parameter

Type

Required?

Notes

RequestType

String

Yes

See table below for the accepted values.

Id

Int64

Yes

The key value of object. For example, the Task id, Task comment id, the project id, or the mention id.

RequestType Accepted Values

New Project

Update Project

New Task

Update Task

New Task Comment

Update Task Comment

Share Task

Mention

Examples

Trigger a notification after creating a new task comment

# Create a new task comment
$entry = @{
    TaskId          = 993
    CommentTypeId   = 1
    Value           = "Documents have been collected."
}

# Create the comment. The created entry will be returned back.
$comment = Add-TaskComment -Entry $entry

if ($null -ne $comment) {
    # Invoke a new task comment notification on the newly created task comment
    Invoke-Notification `
        -RequestType "New Task Comment" `
        -Id $comment.TaskCommentId
        
    Write-Output "New task comment invoked on task comment $($comment.TaskCommentId) for task $($comment.TaskId)"
}

Execution results:

New task comment invoked on task comment 1049 for task 993