home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.11k stars 29.16k forks source link

Method deprecated for file-based message: SlackApi #121672

Open vikashsonu900 opened 2 weeks ago

vikashsonu900 commented 2 weeks ago

The problem

I have below config and when I am sending the image it results in below error.

service: notify.slack
metadata: {}
data:
  target: "#channel"
  message: Snapshot
  data:
    file: 
      path: "/config/www/image.jpg"
Logger: homeassistant.components.slack.notify
Source: components/slack/notify.py:173
integration: Slack ([documentation](https://www.home-assistant.io/integrations/slack), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+slack%22))
First occurred: 12:18:10 PM (1 occurrences)
Last logged: 12:18:10 PM

Error while uploading file-based message: SlackApiError("The request to the Slack API failed.\nThe server responded with: {'ok': False, 'error': 'method_deprecated'}")

What version of Home Assistant Core has the issue?

core-2024.7.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

slack

Link to integration documentation on our website

https://www.home-assistant.io/integrations/slack

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 2 weeks ago

Hey there @tkdrob, @fletcherau, mind taking a look at this issue as it has been labeled with an integration (slack) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `slack` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign slack` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


slack documentation slack source (message by IssueLinks)

bmcdonnell-zz commented 2 weeks ago

The deprecated method appears to be files.upload. While that api will continue to function until March 2025, newly created apps (those of us adding the Slack integration now) can't use this method.

From the linked Slack page:

Existing apps & integrations should migrate away from files.upload and instead leverage a combination of two APIs: files.getUploadURLExternal and files.completeUploadExternal. The use of these two methods is more reliable, especially when uploading large files.

RemyyB commented 1 week ago

I currently have the same issue. First I had to add the "files:write" scope, then later I got the same error that this function is deprecated. Is there any workaround or fix I can use?