> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trypopcorn.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect knowledge, tools, channels and notifications

> Give an agent knowledge bases and custom tools, attach WhatsApp numbers and the Website chat widget, and set where handover alerts go.

An agent only answers from the knowledge bases it can read, only calls the tools connected to it, and only picks up conversations on the channels attached to it. All of this is set on the agent's own page, on the **Knowledge**, **Actions** (**Tools**), **Channels** and **Handoff** (**Alerts**) tabs. Like every other agent setting, these connections are saved as a draft and reach customers when you [publish](https://docs.trypopcorn.ai/agents/test-and-publish.md).

## Before you start

* Click **Agent** in the sidebar and open the agent. You need a role that can edit agents.
* Knowledge lives in knowledge bases. Create them and publish their articles under **Knowledge** in the sidebar first (see [Knowledge overview](https://docs.trypopcorn.ai/knowledge/overview.md)).
* Custom tools are created under **Tools** first (see [Create a custom tool](https://docs.trypopcorn.ai/tools/create-a-tool.md)). A tool does not need to be public to be connected.
* WhatsApp numbers are connected to the workspace under **Integrations → WhatsApp** before they can be attached to an agent (see [WhatsApp](https://docs.trypopcorn.ai/channels/whatsapp.md)).
* Slack alerts need the agent to exist already: the **Create agent** page cannot connect Slack.

## Give the agent access to knowledge bases

**1. Open the Knowledge tab**

On the agent's page, open **Knowledge**. Every knowledge base in your workspace is listed with its name and description, and the tab shows how many are switched on. Above them, once the nightly Knowledge check has looked at this agent, **What it knows** says whether it has questions for you, with **Review** or **Open Knowledge** (see [Review what your agent learned](https://docs.trypopcorn.ai/knowledge/knowledge-check.md)).

**2. Turn knowledge bases on or off**

Switch on each one the agent should be able to read. Access is granted knowledge base by knowledge base, and the description helps the agent pick the right one for a question.

**3. Create a knowledge base if you need one**

**New knowledge base** (shown when you have none) and **Manage knowledge** (shown once you have some) take you to **Knowledge**. Come back and switch the new knowledge base on once it has articles.

**4. Save and publish**

Click **Save and review**, then **Publish changes**. Knowledge access is part of the published version, so customers only see the change after publishing.

To check that articles are actually used and to test answers, see [Connect knowledge to agents](https://docs.trypopcorn.ai/knowledge/connect-to-agents.md).

## Connect custom tools

Custom tools let the agent call your own systems during a conversation (see [Custom tools](https://docs.trypopcorn.ai/tools/overview.md)).

**1. Find Tools on the Actions tab**

On the **Actions** tab, scroll to **Tools** ("Actions you set up yourself or add from the marketplace."). Your workspace's custom tools are listed with a switch each. If you have none yet, it shows **No tools yet** with **Add tool**, which opens the tool builder, and **Open marketplace**, which opens the Tools Showcase. Once you have tools, **Add tool**, **Open marketplace** and **Manage tools** are at the bottom of the panel.

**2. Switch a tool on**

Turn on the tools this agent should be able to call. Turning a tool off removes it from the agent.

**3. Save and publish**

Click **Save and review**, then **Publish changes**.

> [!NOTE]
>
> Connecting copies the tool into the agent, header values included, so a tool cannot be deleted while an agent still uses it: turn it off on each agent's **Actions** tab and save first. Editing the tool under **Tools** later updates the agent's copy. If a tool could not be enabled when you save, you see *Couldn't turn on … Your other changes were saved.* with the tool names; everything else is saved, so switch the tool on again and click **Save and review**.

## Attach channels

### WhatsApp numbers

**1. Open the Channels tab**

On the **Channels** tab, the **WhatsApp** panel ("The numbers this agent answers on.") lists every number connected to your workspace, each with a switch.

**2. Switch numbers on or off**

Switch on each number the agent should answer. **Add number** takes you to **Integrations → WhatsApp** to connect a new number. If you have no numbers yet, the panel reads **No WhatsApp numbers yet**.

**3. Save and publish**

Number changes are staged in the draft and take effect when you click **Publish changes**.

What to expect:

* A number can be attached to one agent at a time. Publishing fails with **One or more WhatsApp channels are connected to another agent** until you disconnect the number from the other agent.
* A number that is attached to no agent is answered by the workspace's default agent.
* An agent must have a published version before a number can be routed to it.
* Switching a number off moves that number's open conversations to your default agent immediately when you publish, whatever you choose for open chats in the publish dialog. The dialog lists the numbers it applies to.

**Manage sandbox numbers** on the same panel opens **Test on WhatsApp**, a shared test number for trying an agent on WhatsApp before connecting your own number. See [Test and publish](https://docs.trypopcorn.ai/agents/test-and-publish.md).

### Website chat widget

The **Website chat widget** panel ("Paste this code into your website's HTML, just before the closing body tag.") shows an embed code that opens this agent in Website chat. Click **Copy code** (you see **Copied to clipboard**) and paste the snippet into your site. The name, avatar and welcome message Website chat shows are set under **Integrations → Website chat**; see [Website chat](https://docs.trypopcorn.ai/channels/website-chat.md).

## Get notified when the agent hands over

The **Alerts** panel on the **Handoff** tab ("How your team hears about a handover.") controls where your team is alerted when a conversation leaves the AI. An alert is sent when the agent hands over through **Hand over to your team**, when **Block spam and off-topic chats** hands over after repeated flagged messages, and when Popcorn hands over on its own because the workspace has no credits, its plan through Zid has ended, no agent is available, or a reply could not be generated. A conversation handed over this way appears in **Unassigned** and in the **Needs you** folder in the Inbox.

### Slack

**1. Turn on Slack alerts for handovers**

Switch on **Slack alerts for handovers** ("Posts in Slack each time a chat is handed to your team.").

**2. Connect Slack**

The panel reads **Slack isn't connected, so these alerts won't arrive yet.** Click **Connect Slack**. Slack opens in a new window and asks you to authorize Popcorn and choose the channel that should receive the alerts. When the window closes you see **Slack is connected**; the panel then shows a **Connected** badge and the button becomes **Reconnect Slack**. If the window does not open, you see **Allow pop-ups for this site, then connect Slack again.**

**3. Save again, then publish**

Connecting Slack updates the agent directly. If you had already saved a draft, click **Save and review** again before publishing, otherwise publishing stops with **Draft is out of date with the live agent configuration**.

Each Slack alert is titled **Human Handover** and includes the customer's name and phone number, their email if known, the tag applied by the handover if any, and a link to the conversation.

### Email

**1. Turn on Email alerts for handovers**

Switch on **Email alerts for handovers** ("Emails your team each time a chat is handed over.").

**2. Add recipients**

Type an address under **Add a recipient** and press Enter or click **Add**. Recipients appear under **Recipients**; remove one with the **X** on its chip. An address that is already listed cannot be added twice (**This address is already on the list.**), and you need at least one (**Add at least one email address.**) before the agent can be saved.

**3. Save and publish**

Click **Save and review**, then **Publish changes**.

Every recipient receives an email with the subject **Human Handover - Popcorn AI**, the customer's name, phone number and email if known, and a **View Conversation** button.

## Related

* [Test and publish an agent](https://docs.trypopcorn.ai/agents/test-and-publish.md): drafts, the publish dialog, version history and rollback.
* [Capabilities](https://docs.trypopcorn.ai/agents/capabilities.md): the handover and safety settings that decide when a handover happens.
* [Working conversations](https://docs.trypopcorn.ai/inbox/working-conversations.md): what your team does with a handed-over conversation.
* [Troubleshooting AI agents](https://docs.trypopcorn.ai/agents/troubleshooting.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.