kestra-io / kestra-io/plugin-microsoft365

TeamsExecution: customMessage / customFields not shown in Teams notification

Open
#113 0 comments 0 reactions 1 assignee Claimed by @Malaydewangan09 View on GitHub
area/plugin kind/customer-request
Dominant language
Java
Stars
3
Forks
5
Avg merge
1d 21h
Merged PRs (30d)
7

Description

## Summary

`TeamsExecution` silently drops the `customMessage` (and `customFields`) property from the Teams notification it sends. The property is documented and accepted, but never appears in the resulting Microsoft Teams card.

## Actual Behaviour

Setting `customMessage` (or `customFields`) on a `io.kestra.plugin.microsoft365.teams.TeamsExecution` task has no visible effect — the Teams card is posted without the custom message.

Root cause: `ExecutionService.executionMap()` (Kestra core, `io.kestra.core.plugins.notifications.ExecutionService`) does add `customMessage` and `customFields` to the `templateRenderMap` for any `ExecutionInterface` task. But `TeamsExecution`'s own template — `src/main/resources/teams-template.peb` — never references `{{customMessage}}` or `{{customFields}}` in any section or fact. The values reach the template context and are then discarded because nothing in the template reads them.

`TeamsIncomingWebhook` is unaffected (it doesn't use this template) and works as a workaround today.

## Expected Behaviour

When `customMessage` is set, it should appear in the posted Teams card (e.g. as an additional fact). When `customFields` is set, each entry should appear as its own fact.

## Reproducer

```yaml
id: alert_test
namespace: data

tasks:
- id: fail_on_purpose
type: io.kestra.plugin.scripts.shell.Commands
runner: PROCESS
commands:
- echo "Test test test"
- exit 1

errors:
- id: alert_teams
type: io.kestra.plugin.microsoft365.teams.TeamsExecution
url: "{{ secret('TEAMS_WEBHOOK') }}"
activityTitle: "Kestra flow failed: {{ flow.namespace }}.{{ flow.id }}"
executionId: "{{ execution.id }}"
customMessage: "Test test test"
```

Expected: `customMessage` visible in the Teams card. Actual: it is missing entirely.

## Logs / Stack Trace

No logs available — this is a silent drop, not an error.

## Environment

- **Kestra version**:
- **Plugin version**:
- **Deployment**:

## Additional Context

Suggested fix: add `customMessage` (and `customFields`, as additional facts) to `teams-template.peb`'s `facts` array, guarded with Pebble `{% if ... is defined %}`. Note: Pebble's `{% for %}` tag does not support Jinja-style `for key, value in map` destructuring — iterate a map via `{% for entry in customFields %}{{ entry.key }}: {{ entry.value }}{% endfor %}` instead.

Test coverage gap: `TeamsExecutionTest` / `flows/teams/teams.yaml` has no case that sets `customMessage`, which is why this shipped uncaught. The fix should add that coverage.

---
*[View as Artifact](https://claude.ai/artifact/7mXn6wF4BC2x1bjSeKsiYu)*

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.