# Slack Connect Invite Approval

Approve or deny Slack Connect invite requests with an automation, for example to allow partner domains and deny everyone else

An [automation](https://www.tryrisotto.com/docs/dashboard/automations) can decide Slack Connect invite requests for you. When a member asks to invite someone from outside your organization to a channel, Slack holds the invite and sends the request to Risotto. The automation runs, and its instructions decide whether to approve the invite, deny it, or message the requester.

## How it works

1. A member invites an external person to a channel. Slack holds the invite as a request instead of sending it.
2. Slack sends the request to your [Slack Tools](https://www.tryrisotto.com/docs/integrations/tools/slack/setup) app, which passes it to Risotto.
3. Risotto starts every enabled automation with the **Slack Connect invite requested** trigger. A request that invites several people starts one run for each person.
4. The automation approves or denies the invite with the **Approve Slack Connect Invite Request** and **Deny Slack Connect Invite Request** tools. When it approves, Slack sends the invite. When it denies, Slack tells the requester.

## Prerequisites

- Slack **Enterprise Grid**, and a Slack org admin who can change Slack Connect settings.
- The [Slack Tools connector](https://www.tryrisotto.com/docs/integrations/tools/slack/setup) installed **across the entire Slack organization** (an org-wide install). A workspace install cannot approve or deny invite requests.
- The Slack Tools app added to every workspace where members invite external people. Slack does not add an org-level app to workspaces by itself, and it sends invite requests only from workspaces the app is in. See [Add the app to your workspaces](https://www.tryrisotto.com/docs/integrations/tools/slack/setup#add-the-app-to-your-workspaces).

## Set up

1. **Connect or reconnect Slack Tools**

   Go to **Settings > Integrations** and click the **Slack** card.

   - **New setup.** Click **Connect** on the **Tools app** card and check **Install across the entire Slack organization**. The manifest Risotto gives you already has the scope and the event subscription. Follow the [Slack Tools setup](https://www.tryrisotto.com/docs/integrations/tools/slack/setup).
   - **Existing org-wide setup.** The **Tools app** card shows that Slack does not grant `conversations.connect:manage` yet, and its status button reads **Error**. Click **Error**, then **Reconnect...**, and follow [Reconnecting the connector](https://www.tryrisotto.com/docs/integrations/tools/slack/setup#reconnecting-the-connector). The dialog shows both the scopes and the `event_subscriptions` block to add to your app's manifest.

2. **Confirm Slack verified the events URL**

   When you save a manifest with the event subscription, Slack checks the request URL. In your Slack app, open **Event Subscriptions** and confirm the **Request URL** shows as verified. If it does not, check that the URL matches the one Risotto showed you exactly, and click **Retry**.

   Until Slack verifies the URL, the **Tools app** card on the Slack integration page shows *"Slack does not send automation trigger events to Risotto yet."*

3. **Hold invites for approval in Slack**

   As a Slack org admin, open the Slack Connect channel settings for your organization (`https://app.slack.com/manage/<your-org-id>/slack-connect/settings/channels`). Turn on **Apply automation rules before channel invitations are sent** and save.

   > **Warning:** From now on, Slack holds every external channel invite in your
   > organization until an app approves or denies it. Create and enable the
   > automation before you turn this on.

4. **Add the tools**

   Add **Approve Slack Connect Invite Request** and **Deny Slack Connect Invite Request** from the tool catalog. Add **Send Slack DM** too if the automation should message the requester. The tools use the Slack Tools connector and need no other setup.

5. **Create the automation**

   Create an automation, click **Add trigger**, open **Slack**, and choose **Slack Connect invite requested**. Attach the tools from the previous step, write the instructions (see the [example](#example-instructions)), and turn the automation on.

   > **Note:** Attach the tools to the automation itself. A tool that is only in the
   > catalog is not available to the run, and the run cannot decide the
   > invite.

6. **Test it**

   As a regular member, open a channel, invite someone from outside your organization, and use an address on your allowed list. Slack shows the invite as pending approval, and the automation approves it within a few seconds. Then try an address that is not on the list.

## Trigger fields

Each run handles one invitee and records these fields. In the instructions, type `@` and pick the field, or write the token `{trigger:/<field>}`. See [Referencing trigger fields](https://www.tryrisotto.com/docs/dashboard/automations#referencing-trigger-fields).

| Field                     | Meaning                                                                    |
| ------------------------- | -------------------------------------------------------------------------- |
| `invite_id`               | Slack's ID for this invite. The Approve and Deny tools act on it.          |
| `invitee_email`           | Email address of the person to invite                                      |
| `requester_name`          | Display name of the member who asked                                       |
| `requester_email`         | Email address of that member. Empty when Slack sends no profile.           |
| `requester_slack_user_id` | Slack user ID of that member. Use it to send a DM.                         |
| `channel_id`              | Slack ID of the channel                                                    |
| `channel_name`            | Name of the channel, without the `#`                                       |
| `channel_is_private`      | Whether the channel is private                                             |
| `is_external_limited`     | Whether the invitee can only post in the channel, and cannot invite others |

## Tools

**Approve Slack Connect Invite Request** approves the invite with the given `invite_id`. Slack then sends the invite to the invitee.

**Deny Slack Connect Invite Request** denies the invite with the given `invite_id`. It takes an optional message of at most 560 characters, which Slack shows the requester as the reason.

If someone already decided the invite in Slack, or it expired, both tools report that and take no action. Both tools use the `conversations.connect:manage` scope on the [Slack Tools connector](https://www.tryrisotto.com/docs/integrations/tools/slack/setup).

## Example instructions

This automation approves invites to one partner domain and denies all others. Copy the instructions and paste them into the automation. Each trigger field and each tool becomes a chip.

```text
If {trigger:/invitee_email} ends in "@example.com", approve {trigger:/invite_id} with {tool_template:slack/approve_slack_connect_invite}.
Otherwise, deny {trigger:/invite_id} with {tool_template:slack/deny_slack_connect_invite}, and send a short reason to {trigger:/requester_slack_user_id} with {tool_template:slack/send_dm}.
```

A `{tool_template:…}` token names a tool by its type, not by a tool in your organization. When you paste it, Risotto replaces it with the tool your organization made from that type. If you have more than one, Risotto asks which tool to use. If you have none, Risotto keeps the text and links to set the tool up. You cannot save instructions that still contain a `{tool_template:…}` token.

> **Tip:** Include the `@` in the domain, so `evil-example.com` does not match. Send the
> DM to `requester_slack_user_id`: Slack does not always include the requester's
> email address.

## When no automation handles a request

While **Apply automation rules before channel invitations are sent** is on, an invite waits until an app decides it. If a request arrives and no enabled automation runs for it, Risotto notifies your admins once: *"Slack Connect invite request not handled."* Enable an automation with the trigger, or turn off the Slack setting. Requests that are already waiting can be approved or denied in Slack.

## Troubleshooting

### The trigger is not available in the trigger picker

**Cause**: The Slack Tools connector does not hold `conversations.connect:manage`, or Slack has not verified the events URL.

**Solution**:

- Check that the connector uses an org-wide install
- On the **Tools app** card of the Slack integration page, click **Connected**, then **Reconnect...**, and follow the dialog

### Slack says the request URL verification failed

**Cause**: The **Request URL** in your app's manifest does not match the URL Risotto gave you.

**Solution**:

- Copy the `event_subscriptions` block from the **Reconnect Slack tools** dialog again and paste it into the manifest
- Check that you edited the Slack Tools app, not your Risotto chat app

### Slack shows the URL as verified, but Risotto does not

**Cause**: Slack checks the request URL only when it changes. If Slack verified the same URL for this app before, for example before a reinstall, saving the manifest sends no new check.

**Solution**:

- In your Slack app, change the **Request URL** (for example add `?v=1` to the end), save, then change it back and save again. Each save sends a new check.
- Or wait for the first invite request: when Slack delivers it, Risotto records the URL as verified.

### The invite is held, but no run starts and no alert appears

**Cause**: The Slack Tools app is not in the workspace where the member made the request, so Slack does not send the request to Risotto. This often happens after the app is uninstalled and installed again.

**Solution**:

- [Add the app to the workspace](https://www.tryrisotto.com/docs/integrations/tools/slack/setup#add-the-app-to-your-workspaces), then ask the member to request the invite again
- Decide the waiting invite in Slack

### The invite was sent right away

**Cause**: Slack did not hold the invite, so no request reached Risotto.

**Solution**:

- Check that **Apply automation rules before channel invitations are sent** is on for your organization

### A run finished but did not approve or deny

**Cause**: The Approve and Deny tools are not attached to the automation.

**Solution**:

- Open the automation, attach both tools, and save
- Decide the waiting invite in Slack

Source: https://www.tryrisotto.com/docs/integrations/tools/slack/slack-connect-invite-approval
