To make a function available so that another user (or many users) can access workflows that reference that function, you'll use the function access
command. At this time, functions can be made available to:
In order to enable the function access
command, your app must have been deployed at least once before attempting to make your function available to others.
Re-deploy your app after using function access
Anytime you make permission changes to your function using the function access
command, your app must be redeployed, each time after, in order for the updates to be available in your app's workspace.
Given:
get_next_song
U1234567
You can make your get_next_song
function available to the user U1234567
like this:
$ slack function access --name get_next_song --users U1234567 --grant
To revoke access, replace --grant
with --revoke
.
Given:
calculate_royalties
U1111111
, U2222222
, and U3333333
You can make your function calculate_royalties
available to the above users like this:
$ slack function access --name calculate_royalties --users U1111111,U2222222,U3333333 --grant
To revoke access, replace --grant
with --revoke
.
Given:
notify_escal_team
You can make your notify_escal_team
function available to all of your app's collaborators like this:
$ slack function access --name notify_escal_team --app_collaborators --grant
Given:
get_customer_profile
You can make your get_customer_profile
function available to everyone in your workspace like this:
$ slack function access --name get_customer_profile --everyone --grant
The prompt-based approach allows you to distribute your function to one user, to multiple people, to collaborators, or to everyone in an interactive prompt.
To activate the flow, use the following command in your terminal:
$ slack function access
Given:
reverse
You will answer the first prompt in the following manner:
> reverse (Reverse)
If going from everyone
or app_collaborators
to specific users, you should be offered the option of adding collaborators to specific users.
> specific users (current)
app collaborators only
everyone
> granting a user access
revoking a user's access
Given:
U0123456789
You will answer the following prompt below:
: U0123456789
You can add multiple users at the same time. To do this, separate the user IDs with a comma (e.g. U0123456789
, UA987654321
).
After you've finished this flow, you'll receive a message indicating the type of distribution you chose.
Guests and external users are limited in the workflows they may run based on the scopes defined for the functions in the workflows. There is a predefined set of scopes that are considered "risky", which guest users cannot run. These scopes include the following:
channels:manage
- create and manage public channelschannels:write.invites
- invite members to public channelsgroups:write
- create and manage private channelsgroups:write.invites
- invite members to private channelsusergroups:write
- create and manage usergroupsIf a guest or external user attempts to run a workflow containing a function with one of these scopes, they will receive an error.
For more distributions options, including how to revoke access, head to the distribute command reference.