GithubHelp home page GithubHelp logo

Comments (5)

seratch avatar seratch commented on September 20, 2024 1

Hi @belm0, we appreciate your time and effort in reporting this issue. We also apologize for any inconvenience caused by the changes in the platform's behavior.

Sometime between Oct 20 and Oct 25 2023, text supplied to initial_comment of files_upload() no longer gets formatted.

I tried to reproduce the same misbehavior on my end, but files.upload API call works for me without any issues. If you're still experiencing the same, could you please share a minimum working example for us to reproduce the issue?

The following test code does not include an example for usergroup mention but other syntaxes are working well:

import os
import unittest

from integration_tests.env_variable_names import SLACK_SDK_TEST_BOT_TOKEN, SLACK_SDK_TEST_WEB_TEST_CHANNEL_ID
from slack_sdk.web import WebClient


class TestWebClient(unittest.TestCase):
    """Runs integration tests with real Slack API

    https://github.com/slackapi/python-slack-sdk/issues/1429
    """

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_initial_comment(self):
        token = os.environ[SLACK_SDK_TEST_BOT_TOKEN]
        channel = os.environ[SLACK_SDK_TEST_WEB_TEST_CHANNEL_ID]
        client: WebClient = WebClient(token=token)
        current_dir = os.path.dirname(__file__)
        file = f"{current_dir}/../../tests/data/slack_logo.png"
        v1 = client.files_upload(
            channels=[channel],
            file=file,
            filename="slack_logo.png",
            initial_comment=f"Here is the file for <#{channel}> <https://google.com|this is a link>"
        )

        v2 = client.files_upload_v2(
            channel=channel,
            file=file,
            filename="slack_logo.png",
            initial_comment=f"Here is the file for <#{channel}> <https://google.com|this is a link>"
        )

from python-slack-sdk.

belm0 avatar belm0 commented on September 20, 2024 1

I see-- markdown should work OK for our case.

from python-slack-sdk.

belm0 avatar belm0 commented on September 20, 2024

Thank you. The problem appears related to using the content option, and specifically with filetype='post'.

If I use content and filetype='markdown' then initial_comment is formatted as expected.

If I use content and filetype='post' then initial_comment is not formatted. (The file content itself is, however.)

        v1 = client.files_upload(
            channels=[channel],
            filename="file.md",
            content="content goes _here_",
            filetype='post',   # vs. 'markdown'
            initial_comment=f"Here is the file for <#{channel}> <https://google.com|this is a link>"
        )

from python-slack-sdk.

seratch avatar seratch commented on September 20, 2024

Thanks for your prompt response!

Indeed, this seems to be a regression bug on the platform side. However, I hate say this... but Slack posts are now deprecated in favor of canvas, which is the one currently recommended to use: https://slack.com/help/articles/4426294050451-Slack-feature-retirements

So, please consider going with markdown or anything else that meets your requirements. Sorry for the disruption but I hope this helps clarify what's going on.

from python-slack-sdk.

seratch avatar seratch commented on September 20, 2024

Thank you very much for your understanding. Let me close this issue now.

from python-slack-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.