🔧 Custom Tools Using OpenAPI Spec
Explore the process of creating custom tools with external Apps using OpenAPI Spec
Creating custom tools on Composio is straightforward and can be done via an OpenAPI Spec. Here’s a quick video on how you can add a custom integration to Composio using OpenAPI Spec.
Also, feel free to go through the below step by step guide on how to create a custom integration using OpenAPI Spec.
Create or get the OpenAPI Spec for the App
The first step is to get the OpenAPI Spec for the app you want to integrate with Composio. If the app does not have an OpenAPI Spec, you can create one using the Swagger Editor.
Create the integrations.yaml File
Create an integrations.yaml
file. Below is the base template for the Integrations.yaml file for any custom tool that you create. However, you will modify the auth schems as each tool supports differnt auth methods.
For more details on how to configure the integrations.yaml
file, refer to the Integration YAML Configuration Guide.
Let’s start with creating the yaml file for GitHub by adding the basic info.
name: GitHub
description: Integrate GitHub to manage your repositories directly from Composio.
logo: https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png
categories: ["developer tools", "version control"]
auth_schemes:
Determine the supported auth method by the custom tool that you’re trying to add. Each Auth Method has its own set of fields. These fields are defined under the Auth Method. Please remember that the integrations.yaml
file is indentation sensitive and should be formatted correctly.
You can refer to below snippets of the each auth method to see how these fields are defined. You can add the supported auth methods in the integrations.yaml
file by copying from the below snippets.
Most tools have their auth methods listed in their docs. You can usually find it by searching “custom_tool_name auth docs” on Google. The first result often has what you need.
In this case, GitHub uses OAuth2 for authentication.
name: GitHub
description: Integrate GitHub to manage your repositories directly from Composio.
logo: https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png
categories: ["developer tools", "version control"]
auth_schemes:
- scheme_name: github_oauth2
auth_mode: OAUTH2
authorization_url: "https://github.com/login/oauth/authorize"
token_url: "https://github.com/login/oauth/access_token"
default_scopes: ["repo", "admin:org"]
token_params:
grant_type: authorization_code
authorization_params:
response_type: code
proxy:
base_url: "{{base_url}}"
fields:
- name: base_url
displayName: Base URL
description: "The API base URL for GitHub"
type: string
default: https://api.github.com
You need to add the relevant scopes as needed. Now that you have the integrations.yaml
file ready, push the code and copy the URL of the repository.
Add your Custom Tool on Composio
Go to the settings page on Composio, Go to Add Open API spec
section and upload the Open API Spec file and the integrations.yaml
file. Click on the “Start import” button to test.
Testing Your Custom tool on Composio
Navigate back to the tools catalogue page on Composio. Search for the tool you just created, click on it, and proceed to connect your account.
Was this page helpful?