A .NET API for interacting with Microsoft Copilot Studio using direct-to-engine settings through Dataverse. This API provides a simple interface to communicate with your Copilot Studio bots.
- Built with .NET 8.0
- Direct integration with Microsoft Copilot Studio via Dataverse
- Azure AD OAuth authentication
- Configurable bot and environment settings
- Swagger UI for API documentation
- Error handling and logging
- Context support for conversations
- Health check endpoint
- CORS support for development
- .NET 8.0 SDK
- Azure AD application registration
- Microsoft Copilot Studio environment and bot
- Dataverse environment
Update appsettings.json with your Copilot Studio settings:
{
"DirectToEngineSettings": {
"EnvironmentId": "your-environment-id",
"BotIdentifier": "your-bot-identifier",
"TenantId": "your-tenant-id",
"AppClientId": "your-app-client-id"
}
}Send a message to your Copilot Studio bot.
Request body:
{
"message": "Your message here",
"context": {
"key1": "value1",
"key2": "value2"
}
}Response:
{
"message": "Bot response",
"conversationId": "conversation-id"
}Check the health status of the API.
Response:
{
"status": "Healthy",
"timestamp": "2025-01-13T21:43:14Z"
}- Clone the repository
- Update the configuration in
appsettings.json - Run the application:
cd src/CopilotStudioApi dotnet run - Access Swagger UI at
/swaggerto test the API
The API uses Azure AD OAuth authentication with Dataverse. Make sure your application has the necessary Dataverse API permissions configured in Azure AD:
- Dynamics CRM.user_impersonation
In development mode, the API includes:
- Swagger UI for testing endpoints
- CORS enabled for all origins (configurable)
- Detailed error messages
The API includes comprehensive error handling and logging. Errors are logged and appropriate HTTP status codes are returned.
MIT