MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / validate_bot_token

Function validate_bot_token

scripts/setup_slack.py:105–121  ·  view source on GitHub ↗

Validate bot token by calling auth.test API.

(token: str)

Source from the content-addressed store, hash-verified

103
104
105def validate_bot_token(token: str) -> tuple[bool, str]:
106 """Validate bot token by calling auth.test API."""
107 if not token.startswith("xoxb-"):
108 return False, "Token must start with 'xoxb-'"
109
110 from slack_sdk import WebClient
111 from slack_sdk.errors import SlackApiError
112
113 try:
114 response = WebClient(token=token).auth_test()
115 team = response.get("team", "Unknown")
116 user = response.get("user", "Unknown")
117 return True, f"Workspace: {team}, Bot: @{user}"
118 except SlackApiError as e:
119 return False, e.response["error"]
120 except Exception as e:
121 return False, str(e)
122
123
124def update_vm_env(

Callers 1

mainFunction · 0.70

Calls 1

getMethod · 0.80

Tested by

no test coverage detected