Skip to content

checkboxes in markdown_text when using web-api fails and returns slack_webapi_platform_error #2390

@tylerkohn

Description

@tylerkohn

Using markdown_text fails when sending checkboxes. A slack_webapi_platform_error error is returned.

Note: This appears to be a Slack Web API server-side issue rather than an SDK issue.

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/rtm-api
  • @slack/webhooks
  • @slack/oauth
  • @slack/socket-mode
  • @slack/types
  • I don't know

Reproducible in:

The Slack SDK version

@slack/web-api 7.10.0

Node.js runtime version

v22.17.0

OS info

ProductName: macOS
ProductVersion: 14.5
BuildVersion: 23F79
Darwin Kernel Version 23.5.0: Wed May 1 20:13:18 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6030

Steps to reproduce:

import { WebClient } from "@slack/web-api";
...
      const slackBotToken = "XXXXXXXXXXXXXX";
      const client = new WebClient(slackBotToken);

Works:

      const testText1 =
        "*bold* _italic_ `code` [Google](https://google.com)  \n\n\n # test";
      const result1 = await client.chat.postMessage({
        channel: targetChannel,
        markdown_text: testText1,
        token: slackBotToken,
      });

Results in an Error:

      const testText2 =
        "*bold* _italic_ `code` [Google](https://google.com) \n\n\n - [ ] option1 \n- [x] option2 \n\n\n # test";
      const result2 = await client.chat.postMessage({
        channel: targetChannel,
        markdown_text: testText2,
        token: slackBotToken,
      });

Some additional testing I think shows that this will not error:

- [] option1 \n- [X] option2

this will

- [ ] option1 \n- [X] option2

So upper or lower case "X" makes a difference and spaces in the brackets can make a difference.

Expected result:

Both to send a slack message with properly formatted results (or at least not error and send a message even with stripped out or improperly formatting content).

Actual result:

The first markdown text is sent and formatted correctly.

The second does not, it results in this error when trying to post the message:

{
  "code": "slack_webapi_platform_error",
  "data": {
    "ok": false,
    "error": "internal_error",
    "response_metadata": {
      "scopes": [
        "chat:write",
        "users:read",
        "channels:read",
        "groups:read",
        "im:read",
        "mpim:read",
        "im:write",
        "chat:write.public"
      ],
      "acceptedScopes": [
        "chat:write"
      ]
    }
  }
}

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions