# Send-MtTeamsMessage

Send an adaptive card in a teams channel with the summary of the Maester test results

Source: https://maester.dev/docs/commands/Send-MtTeamsMessage

## SYNOPSIS

Send an adaptive card in a teams channel with the summary of the Maester test results

## SYNTAX

### MSGraph

```powershell
Send-MtTeamsMessage [-MaesterResults] <PSObject> [-TeamId] <String> [-TeamChannelId] <String>
 [-Subject <String>] [-TestResultsUri <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

### Webhook

```powershell
Send-MtTeamsMessage [-MaesterResults] <PSObject> [-TeamChannelWebhookUri] <String> [-Subject <String>]
 [-TestResultsUri <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION

Uses Graph API to send an adaptive card in a teams channel with the summary of the Maester test results.

The Graph API parameter set requires the delegated ChannelMessage.Send permission in Microsoft Graph and sends
the message on behalf of a signed-in work or school account.

Teamwork.Migrate.All is an application permission for importing messages during a migration.
It is not supported
for sending routine Teams alerts.
Use the webhook parameter set in non-interactive environments such as Azure
DevOps and GitHub Actions.

When running interactively this can be done by running the following command:

```
Connect-MtGraph -SendTeamsMessage
```

## EXAMPLES

### EXAMPLE 1

```powershell
Send-MtTeamsMessage -MaesterResults $MaesterResults -TeamId '00000000-0000-0000-0000-000000000000' -TeamChannelId '19%3A00000000000000000000000000000000%40thread.tacv2' -Subject 'Maester Results' -TestResultsUri "https://github.com/contoso/maester/runs/123456789"
```

Sends an Adaptive Card in a Teams Channel with the summary of the Maester test results to the specified channel along with the link to the detailed test results.

### EXAMPLE 2

```powershell
Send-MtTeamsMessage -MaesterResults $MaesterResults -TeamChannelWebhookUri 'https://some-url.logic.azure.com/workflows/invoke?api-version=2016-06-01' -Subject 'Maester Results' -TestResultsUri "https://github.com/contoso/maester/runs/123456789"
```

Sends an Adaptive Card in a Teams Channel with the summary of the Maester test results to the specified channel along with the link to the detailed test results.

## PARAMETERS

### -MaesterResults

The Maester test results returned from `Invoke-Pester -PassThru | ConvertTo-MtMaesterResult`

```yaml
Type: PSObject
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TeamId

The Teams team where the test results should be posted.
To get the TeamId, right-click on the channel in Teams and select 'Get link to channel'.
Use the value of groupId.
e.g.
?groupId=&lt;TeamId&gt;

```yaml
Type: String
Parameter Sets: MSGraph
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TeamChannelId

The channel where the message should be posted.
e.g.
19%3A00000000000000000000000000000000%40thread.tacv2
To get the TeamChannelId, right-click on the channel in Teams and select 'Get link to channel'.
Use the value found between channel and the channel name.
e.g.
/channel/&lt;TeamChannelId&gt;/my%20channel

```yaml
Type: String
Parameter Sets: MSGraph
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TeamChannelWebhookUri

The URL of the webhook where the message should be posted.
e.g.
'https://some-url.logic.azure.com/workflows/invoke?api-version=2016-06-01'
To get the webhook Url, right-click on the channel in Teams and select 'Workflow'.
Create a workflow using the 'Post to a channel when a webhook request is received' template.
Use the value after complete

```yaml
Type: String
Parameter Sets: Webhook
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Subject

The subject of the card.
Defaults to 'Maester Test Results'.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TestResultsUri

Uri to the detailed test results page.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ProgressAction

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

## NOTES

## RELATED LINKS

[https://maester.dev/docs/commands/Send-MtTeamsMessage](https://maester.dev/docs/commands/Send-MtTeamsMessage)
