-
Notifications
You must be signed in to change notification settings - Fork 853
Description
TL;DR: Until a few hours ago, the SDK function conversations_invite() used to succeed with no issues. Now, it fails with error: no_user. It seems that the users argument to the conversations.invite API method may have changed to require a JSON array (rather than a comma-separated string), so conversations_invite() may need to be updated accordingly. CC: @tracertea
Reproducible in:
The Slack SDK version
$ pip freeze | grep slack
slack-bolt==1.6.1
slack-sdk==3.7.0
Python runtime version
$ python --version
Python 3.9.5
OS info
$ sw_vers && uname -v
ProductName: macOS
ProductVersion: 11.2.3
BuildVersion: 20D91
Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64
Steps to reproduce:
Attempt to invite a user to a channel via conversations_invite(), passing the following arguments:
channel(str): The channel IDusers(strorlist): A list of user IDs to invite
Note that if conversations_invite() is passed users as a list (i.e., rather than str—both types are indicated to be valid), it will collapse that list into a comma-separated str, which is consistent with Slack's API documentation for the conversations.invite method's users argument:
A comma separated list of user IDs. Example:
W1234567890,U2345678901,U3456789012
Surprisingly, this will fail:
channel = 'C1234567890'
users = ['U2345678901']
client.conversations_invite(channel=channel, users=users)
# "ok": false, "error": "no_user"However, if we instead bypass conversations_invite() and directly call the conversations.invite method so that users is not collapsed into a comma-separated str and is passed directly as a list, the call succeeds:
channel = 'C1234567890'
users = ['U2345678901']
client.api_call(
"conversations.invite",
json={"channel": channel, "users": users},
)
# "ok": trueExpected result:
Expected a successful response from the conversations.invite API method:
{
"ok": true,
"channel": {
"id": "[REDACTED]",
"name": "[REDACTED]",
"is_channel": true,
"is_group": false,
"is_im": false,
"created": ["REDACTED"],
"is_archived": false,
"is_general": false,
"unlinked": 0,
"name_normalized": "[REDACTED]",
"is_shared": false,
"parent_conversation": null,
"creator": "[REDACTED]",
"is_ext_shared": false,
"is_org_shared": false,
"shared_team_ids": [
"[REDACTED]"
],
"pending_shared": [],
"pending_connected_team_ids": [],
"is_pending_ext_shared": false,
"is_member": true,
"is_private": true,
"is_mpim": false,
"last_read": "[REDACTED]",
"is_open": true,
"topic": {
"value": "",
"creator": "",
"last_set": 0
},
"purpose": {
"value": "",
"creator": "",
"last_set": 0
}
}
}Actual result:
We get an error indicating that "No value was passed for users":
{
"ok": false,
"error": "no_user"
}