# Build your own tools (video)

A video of connecting Risotto to a system it has no integration for: a script tool built in Script Studio with its key in the credential vault, custom API tools from the vendor's spec, and the tool in a runbook, with an approval before it runs.

Watch Risotto connect to a system it has no integration for, by building your own tools. Northwind's IT team runs a badge system for the office doors. The video builds a script tool that suspends a departing employee's badge, imports custom API tools from the badge system's API spec, then runs the script tool from an offboarding runbook, with an approval in Slack first. Each part below links to its written guide.

[Video: Build your own tools](https://media.tryrisotto.com/videos/build-tools-desktop.mp4)

Before you start, sign in as an Org Admin or Manager: only they can create script tools and custom API sources. Have the system's API key ready, and its API spec if the vendor publishes one.

## A script tool, built in Script Studio

1. **Create the tool**

   Open **Tools** in the sidebar and click **New script tool**. Name it, for
   example Badge deactivation, and click **Create and open studio**. See
   [Create a script tool](https://www.tryrisotto.com/docs/integrations/tools/script-tools#create-a-script-tool).

2. **Describe it in the chat**

   Describe what the tool should do: find the departing employee in the badge
   system, suspend their badge, and note it on their ticket. The assistant
   writes the TypeScript, and the flow chart draws one box for each step.

3. **Read the code**

   Click **Code** to read it. At the top, the `domains` export names the one
   host this tool may call. It can call no other host. See [Allowlisted
   HTTP](https://www.tryrisotto.com/docs/integrations/tools/script-tools#allowlisted-http-http).

4. **Keep the key in the vault**

   The API key never goes in the code: the code reads it as `env.BADGE_API_KEY`.
   Open the tool, click **Edit**, and in **Tool Configuration** click **Choose
   a vault credential**, then **Add a vault credential**. Paste the key, set
   its allowed host to the badge system's API host, and click **Create Vault
   Credential**. The vault keeps it write-only, and sends it only to that host.
   See [Credential Vault](https://www.tryrisotto.com/docs/dashboard/settings/credential-vault).

5. **Test it, then publish**

   In the studio, click **Test**. A test is a real run against the real
   system, so use a test user. Each step lights up as it runs. When it passes,
   click **Publish**, and turn the tool on. See [Create a script
   tool](https://www.tryrisotto.com/docs/integrations/tools/script-tools#create-a-script-tool).

## Custom API tools, from the vendor's spec

When one call is enough, no code is needed.

1. **Add an API source**

   Go to **Settings**, then **Integrations**. Click **New custom
   integration**, then **API source**, and name it. See [Create custom API
   tools](https://www.tryrisotto.com/docs/integrations/tools/custom-api-tools#create-custom-api-tools).

2. **Import the vendor's spec**

   Import the vendor's OpenAPI spec from a file or a link. No spec? Paste a
   cURL command from the vendor's docs, or build the endpoint by hand.

3. **Pick the endpoints**

   Pick the endpoints you want. Each one becomes a tool: here, one looks up a
   cardholder, and one adds them to a door group.

4. **Use the same key**

   For authentication, choose **Bearer token**, and pick the same badge key
   from the vault. Every tool from this source shares it. A custom API source
   can use org-wide credentials only.

5. **Review and publish**

   Approval is on for every new tool. Keep it on for the tool that changes
   access, turn it off for the lookup, and click **Publish 2 tools**.

## The tool in a runbook, with an approval

1. **Add the tool to a runbook**

   Open your offboarding runbook, type `#` in the instructions, and pick
   **Badge deactivation**. Because the script writes to the ticket, the tool
   requires approval, and you can't turn that off. See [Approvals and
   security](https://www.tryrisotto.com/docs/integrations/tools/script-tools#approvals-and-security).

2. **Approve it in Slack**

   When someone asks IT to offboard an employee, Risotto follows the runbook.
   Before the badge tool runs, an approval request comes to IT's agent
   channel, with the tool's parameters. Click **Approve**. One approval covers
   the whole run. To choose who approves, attach an [approval
   policy](https://www.tryrisotto.com/docs/dashboard/settings/approval-policies#attaching-a-policy-to-a-tool).

3. **Read the run history**

   The badge is suspended, the ticket gets a note, and the requester gets
   the answer in the thread. The tool's **Run history** shows every step of
   every run. See [Run history and version
   history](https://www.tryrisotto.com/docs/integrations/tools/script-tools#run-history-and-version-history).

Use a script tool for several steps in order, and a custom API tool for one call. For the Assistant building a script tool for you, see [Use the Assistant (video)](https://www.tryrisotto.com/docs/guides/assistant-video).

Source: https://www.tryrisotto.com/docs/guides/build-tools-video
