Creating Custom Connectors in Microsoft Copilot Studio (Power Virtual Agents)
Custom connectors in Microsoft Copilot Studio (formerly Power Virtual Agents) allow you to integrate external services, APIs, or data sources into your chatbot. This provides flexibility to extend the chatbot’s capabilities beyond built-in options.
Step-by-Step Guide to Creating a Custom Connector in Copilot Studio
Step 1: Understanding Custom Connectors
Before creating a custom connector, understand that:
- It acts as a bridge between your chatbot and an external API.
- It can connect to RESTful APIs using authentication methods such as API keys, OAuth 2.0, or Basic Authentication.
- Once created, it can be reused across multiple applications within Power Platform.
Step 2: Preparing the API
You need an API to integrate with Copilot Studio.
Ensure the API:
- Is publicly accessible or within an authenticated network.
- Uses a standard REST structure (GET, POST, PUT, DELETE).
- Has a valid OpenAPI (Swagger) specification or Postman collection for easy import.
- Supports authentication if required.
Step 3: Accessing Power Platform to Create a Custom Connector
To create a custom connector in Copilot Studio, follow these steps:
- Go to Power Platform
- Open Power Apps or go to Power Automate.
- Sign in with your Microsoft account.
- Navigate to Custom Connectors
- In the left navigation panel, click on Dataverse → Custom Connectors.
- Click + New Custom Connector.
- Choose an option:
- Create from blank (if you want to manually configure everything).
- Import from OpenAPI (Swagger).
- Import from Postman collection.
Step 4: Defining Custom Connector Details
- Enter Basic Information
- Name your connector (e.g., “Weather API Connector”).
- Add an icon (optional) and description.
- Set Up Authentication
- Choose an authentication type based on your API:
- No authentication – If API is public.
- API Key – If API requires a key in the header or query.
- OAuth 2.0 – If API requires user authentication.
- Basic Authentication – If API requires a username and password.
- Choose an authentication type based on your API:
Step 5: Defining API Endpoints
- Enter Base URL
- Input the API’s base URL (e.g.,
https://api.weather.com
).
- Input the API’s base URL (e.g.,
- Add Actions (Operations)
- Click + New Action.
- Provide:
- Summary – A brief description.
- Operation ID – A unique identifier.
- Request URL – The endpoint URL (e.g.,
/forecast
). - Method Type – Select from GET, POST, PUT, DELETE.
- Headers & Query Parameters – Add required parameters.
Step 6: Configuring Responses
- Click “Response” Section
- Add a Sample Response
- Run the API in Postman and copy a successful response JSON.
- Paste it in the Response Definition.
- Define response parameters (e.g., temperature, humidity).
Step 7: Testing the Custom Connector
- Click “Test” Tab.
- Authenticate (if required).
- Enter Parameters and click Test Operation.
- If successful, you will see a valid JSON response.
Step 8: Using the Custom Connector in Copilot Studio
- Open Microsoft Copilot Studio.
- Go to Topics and create/edit a topic.
- Click Add an Action.
- Select Call an Action → Choose Custom Connector.
- Map input/output parameters.
- Save and Test.
Final Notes
- Custom connectors can be shared across Power Apps and Power Automate.
- Use environment variables for secure API key storage.
- Enable logging to monitor API requests.