admin.users.invite returns user_disabled / failed_to_send_invite instead of reactivating a deactivated guest

未關閉
#2,066 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
半天
新手友好度
42/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
python
領域
api

研究方向

Start with the admin_users_invite method in slack_sdk/web/client.py and the payloads it sends, then compare them with the published admin.users.invite contract; the reported errors come from Slack's server, not from Python code, so read the response handling before assuming an SDK defect. Reproducing needs an Enterprise Grid org with an org-level admin token and deactivated guest accounts, which most contributors cannot obtain, so first confirm with the maintainers whether the outcome is a docs clarification or an SDK change. Done means the documented reactivation behaviour and the user_disabled / failed_to_send_invite errors are reconciled and guests-only cases are explicitly addressed.

由索引模型根據 Issue 內容生成。

描述

Summary

admin.users.invite does not reactivate a deactivated guest user, although the docs say it should. Instead it returns user_disabled or failed_to_send_invite, depending on the user's previous status.

The admin.users.invite docs say:

This Admin API invites a user to a workspace. If this method is used on a workspace-level user who is deactivated on the org level, the user will be reactivated on both the workspace and the org level.

The error table describes user_disabled only as "The user account is disabled." It doesn't explain how that fits with the reactivation behavior described above.

Reproducible in
slack_sdk==3.45.0
Python 3.12.1
OS: macOS (Darwin 25.6.0)
Enterprise Grid org, org-level admin user token with admin.users:write
Steps to reproduce
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError

client = WebClient(token="xoxp-...")  # org admin user token

try:
    response = client.admin_users_invite(
        team_id="T...",                 # workspace the user previously belonged to
        email="[email protected]",
        channel_ids="C...",
        is_ultra_restricted=True,
    )
    print(response.data)
except SlackApiError as e:
    print(e.response["error"])
Case User's status before the call (as shown in admin) Result
A Deactivated, previously Multi-Channel Guest user_disabled
B Deactivated, previously Invited Guest (never accepted the invite) failed_to_send_invite

In both cases the user is deactivated at the org level.

I tried both guest role options and got the same results each time, so the failure doesn't seem to come from a mismatch between the requested role and the user's previous role:

  • is_ultra_restricted=True, is_restricted=False (single-channel guest)
  • is_ultra_restricted=False, is_restricted=True (multi-channel guest)
Expected result

Based on the docs, the user is reactivated at the workspace and org levels and gets access to the given channel(s).

Actual result

The call fails with user_disabled (case A) or failed_to_send_invite (case B), and the user stays deactivated.

Questions
  1. Does the reactivation behavior apply to guest accounts (multi-channel or single-channel), or only to full members? If only to members, could the docs say so?
  2. What does user_disabled mean for this method, given that the docs say a deactivated user will be reactivated?
  3. For a user who was only ever invited and never accepted (case B), what is the supported way to re-invite or reactivate them through the API?
  4. If guests can't be reactivated this way, what is the recommended API for reactivating a deactivated guest as a single-channel or multi-channel guest?

Thanks!

主要語言
Python
星號
4k
分支
874
平均合併
13 小時 22 分鐘
30 天內合併 PR
64

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

slackapi/python-slack-sdk 的其他 Issue

查看 slackapi/python-slack-sdk 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。