intuit / intuit/auto

Microsoft Teams - Invalid Message Formatting

Open
#2,020 5 comments 5 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.5k
Forks
221
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Getting incorrect formatted message using MS Teams plugin. Text looks like escaped version with special characters like `\n`. For example:
![screes_actual](https://user-images.githubusercontent.com/643360/122956690-832df080-d381-11eb-9b93-302fc2c8b130.png)

**To Reproduce**

Enable `microsoft-teams` plugin and execute `auto shipit`

**Expected behavior**

Message in MS Teams channel looks closed to formatted version from generated `CHANGELOG.md`. E.g. there are URLs, multiline formatting and basic emoji icons.

![screen_expected](https://user-images.githubusercontent.com/643360/122956788-9b9e0b00-d381-11eb-940c-b571d194786f.png)

**Screenshots**

![screes_actual](https://user-images.githubusercontent.com/643360/122956941-bf615100-d381-11eb-981d-26f14f99f0a3.png)

**Environment information:**

```txt
Linux, sh
auto v10.29.3
git 2.20.1
```

**Additional context**

Message in MS Teams channel looks like escaped/serialized markdown version. I performed two tests:
1. Copy message from MS Teams channel and resend it via Postman using MS Teams Web hook URL. As result got well formatted text (more-less, because URLs links was missed)
2. I copied text from generated `CHANGELOG.md` file, perform JSON string escaping and send it it via Postman using MS Teams Web hook URL. As result got well formatted text (only few icons were missed, but this is MS Teams related issue).

Based on this, I conclude that MS Teams API works fine but issue is with formatting on sender side.

For example what I did manually and hat works fine:
source text from `CHANGELOG.md`:
```
:tada: This release contains work from a new contributor! :tada:

Thank you, DevName1 ([@DEV001](https://git.blahblah.com/DEV001)), for all your work!

#### 🐛 Bug Fix

- Hotfix([PROJ-1234](https://jira.blahblah.com/browse/PROJ-1234): ): use different step size for price and power filter … [#678](https://git.blahblah.com/some/repo/pull/678) ([@DEV001](https://git.blahblah.com/DEV001))

#### Authors: 1

- DevName1 ([@DEV001](https://git.blahblah.com/DEV001))

---
```

escaped string:
```
:tada: This release contains work from a new contributor! :tada:\n\nThank you, DevName1 ([@DEV001](https://git.blahblah.com/DEV001)), for all your work!\n\n#### 🐛 Bug Fix\n\n- Hotfix([PROJ-1234](https://jira.blahblah.com/browse/PROJ-1234): ): use different step size for price and power filter … [#678](https://git.blahblah.com/some/repo/pull/678) ([@DEV001](https://git.blahblah.com/DEV001))\n\n#### Authors: 1\n\n- DevName1 ([@DEV001](https://git.blahblah.com/DEV001))\n\n---
```
Request for MS Teams WEB Hook:
```
{
"@context": "https://schema.org/extensions",
"@type": "MessageCard",
"themeColor": "0072C6",
"title": "Test",
"text": ":tada: This release contains work from a new contributor! :tada:\n\nThank you, DevName1 ([@DEV001](https://git.blahblah.com/DEV001)), for all your work!\n\n#### 🐛 Bug Fix\n\n- Hotfix([PROJ-1234](https://jira.blahblah.com/browse/PROJ-1234): ): use different step size for price and power filter … [#678](https://git.blahblah.com/some/repo/pull/678) ([@DEV001](https://git.blahblah.com/DEV001))\n\n#### Authors: 1\n\n- DevName1 ([@DEV001](https://git.blahblah.com/DEV001))\n\n---",
}

```

May be somehow related to `sanitizeMarkdown()` function inside https://github.com/intuit/auto/blob/main/plugins/microsoft-teams/src/index.ts and https://github.com/intuit/auto/pull/1914 changes.

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.