Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions src/dispatch/plugins/dispatch_slack/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@


class SlackAPIGetEndpoints(DispatchEnum):
chat_permalink = "chat.getPermalink"
conversations_history = "conversations.history"
conversations_info = "conversations.info"
team_info = "team.info"
users_conversations = "users.conversations"
users_info = "users.info"
users_lookup_by_email = "users.lookupByEmail"
Expand Down
21 changes: 3 additions & 18 deletions src/dispatch/plugins/dispatch_slack/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ def list_conversation_messages(client: WebClient, conversation_id: str, **kwargs
)


@functools.lru_cache()
def get_domain(client: WebClient) -> str:
"""Gets the team's Slack domain."""
return make_call(client, SlackAPIGetEndpoints.team_info)["team"]["domain"]


@functools.lru_cache()
def get_user_info_by_id(client: WebClient, user_id: str) -> dict:
"""Gets profile information about a user by id."""
Expand Down Expand Up @@ -194,7 +188,7 @@ def create_conversation(client: WebClient, name: str, is_private: bool = False)
return {
"id": response["id"],
"name": response["name"],
"weblink": f"https://{get_domain(client)}.slack.com/app_redirect?channel={response['id']}",
"weblink": f"https://slack.com/app_redirect?channel={response['id']}",
}


Expand Down Expand Up @@ -269,15 +263,6 @@ def add_users_to_conversation(
pass


def get_message_permalink(client: WebClient, conversation_id: str, ts: str) -> str:
return make_call(
client,
SlackAPIGetEndpoints.chat_permalink,
channel=conversation_id,
message_ts=ts,
)


def send_message(
client: WebClient,
conversation_id: str,
Expand All @@ -302,7 +287,7 @@ def send_message(
return {
"id": response["channel"],
"timestamp": response["ts"],
"weblink": get_message_permalink(client, response["channel"], response["ts"]),
"weblink": f"https://slack.com/app_redirect?channel={response['id']}", # TODO should we fetch the permalink?
}


Expand All @@ -326,7 +311,7 @@ def update_message(
return {
"id": response["channel"],
"timestamp": response["ts"],
"weblink": get_message_permalink(client, response["channel"], response["ts"]),
"weblink": f"https://slack.com/app_redirect?channel={response['id']}", # TODO should we fetch the permalink?
}


Expand Down