Connect to Slack

Allow users to connect to a Slack workspace


Overview #

Calling this method will trigger a popup window to appear containing a flow for the user to link their Cord user to a Slack user. Completion of the flow will additionally connect the user's Slack workspace to their Cord group if that Cord group is not already connected to a Slack workspace. Calling this method will not do anything if the Cord user is already linked to a Slack user.
Vanilla JavaScript:
window.CordSDK.user.connectToSlack({
   onCompleteOAuth: (success) => console.log('Has user successfully signed into Slack: ', success)
});
window.CordSDK.user.connectToSlack({
   onCompleteOAuth: (success) => console.log('Has user successfully signed into Slack: ', success)
});
Copy

What this function returns #

This function returns a promise that resolves to nothing when the Slack connection popup window opens.

Arguments this function takes #


options #

optional
ConnectToSlackOptions

This is an object with the following fields:


onCompleteOAuth #

optional
(success: boolean) => void
This callback will be called once the user has finished/cancelled the oauth process. If users interrupt the OAuth process by closing the popup window, this callback will not run. The argument passed to the callback is a boolean which states if the user has successfully connected Slack.

groupID #

optional
string
The group the user should connect to Slack in. The viewer must be a member of the group in order for the connection flow to trigger.

Ask Cordy