Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Slack file upload and unfurling issues (resolves #121672) #132451

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9a001a7
Update Slack integration to use slack_sdk, add tests, and adjust code…
jsuar Dec 6, 2024
fd7061e
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Dec 6, 2024
a65bb6b
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Dec 6, 2024
cdae8f0
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Dec 6, 2024
7414730
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Dec 7, 2024
2a559f3
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Dec 9, 2024
f817c26
Enhance Slack image upload handling: read image data on success, hand…
jsuar Dec 29, 2024
6aea3a8
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Dec 29, 2024
ef773a1
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 3, 2025
5d23005
Simplify remote file share
jsuar Jan 12, 2025
157ee40
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 12, 2025
9f4fd50
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 12, 2025
ff97975
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 12, 2025
e2048e9
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 13, 2025
5592dc1
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 13, 2025
19c62aa
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 13, 2025
e97c321
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 13, 2025
1c3e59c
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 13, 2025
24667b4
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 13, 2025
b13e2b5
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 14, 2025
67de886
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 14, 2025
5be483e
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 14, 2025
b1cf7ac
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 15, 2025
197ad96
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 16, 2025
a91ac5a
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 16, 2025
fb0c1ef
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 16, 2025
0efc566
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 16, 2025
d3ad556
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 16, 2025
b95cff9
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 16, 2025
b9bf969
Merge branch 'dev' into update-slack-file-upload-issue-121672
jsuar Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CODEOWNERS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions homeassistant/components/slack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import logging

from aiohttp.client_exceptions import ClientError
from slack import WebClient
from slack.errors import SlackApiError
from slack_sdk.errors import SlackApiError
from slack_sdk.web.async_client import AsyncWebClient

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, Platform
Expand Down Expand Up @@ -40,7 +40,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Slack from a config entry."""
session = aiohttp_client.async_get_clientsession(hass)
slack = WebClient(token=entry.data[CONF_API_KEY], run_async=True, session=session)
slack = AsyncWebClient(token=entry.data[CONF_API_KEY], session=session)

try:
res = await slack.auth_test()
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/slack/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import logging

from slack import WebClient
from slack.errors import SlackApiError
from slack_sdk.errors import SlackApiError
from slack_sdk.web.async_client import AsyncSlackResponse, AsyncWebClient
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
Expand Down Expand Up @@ -57,10 +57,10 @@ async def async_step_user(

async def _async_try_connect(
self, token: str
) -> tuple[str, None] | tuple[None, dict[str, str]]:
) -> tuple[str, None] | tuple[None, AsyncSlackResponse]:
"""Try connecting to Slack."""
session = aiohttp_client.async_get_clientsession(self.hass)
client = WebClient(token=token, run_async=True, session=session)
client = AsyncWebClient(token=token, session=session)

try:
info = await client.auth_test()
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/slack/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from slack import WebClient
from slack_sdk.web.async_client import AsyncWebClient

from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
Expand All @@ -19,7 +19,7 @@ class SlackEntity(Entity):

def __init__(
self,
data: dict[str, str | WebClient],
data: dict[str, str | AsyncWebClient],
description: EntityDescription,
entry: ConfigEntry,
) -> None:
Expand All @@ -28,7 +28,7 @@ def __init__(
self.entity_description = description
self._attr_unique_id = f"{data[ATTR_USER_ID]}_{description.key}"
self._attr_device_info = DeviceInfo(
configuration_url=data[ATTR_URL],
configuration_url=str(data[ATTR_URL]),
entry_type=DeviceEntryType.SERVICE,
identifiers={(DOMAIN, entry.entry_id)},
manufacturer=DEFAULT_NAME,
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/slack/manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"domain": "slack",
"name": "Slack",
"codeowners": ["@tkdrob", "@fletcherau"],
"codeowners": ["@tkdrob", "@fletcherau", "@jsuar"],
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/slack",
"integration_type": "service",
"iot_class": "cloud_push",
"loggers": ["slack"],
"requirements": ["slackclient==2.5.0"]
"requirements": ["slack_sdk==3.33.4"]
}
Loading