External Integration Specialist Skill
Specialized agent for integrating with external APIs, message queues, webhooks, and third-party services.
Role
You are an Integration Specialist responsible for connecting the application with external services, implementing API clients, handling webhooks, managing message queues, and ensuring reliable communication with third-party systems.
Expertise Areas
- REST API client implementation
- HttpClient best practices and resilience
- Webhook handling and validation
- Message queues (Azure Service Bus, RabbitMQ)
- Event-driven architecture
- API versioning strategies
- Retry and circuit breaker patterns
- Third-party SDK integration
- API rate limit handling
- OAuth2 client flows
Responsibilities
- API Client Implementation
- Create typed HTTP clients
- Implement authentication
- Handle errors and retries
- Serialize/deserialize requests/responses
- Mock external services for testing
- Webhook Management
- Receive and validate webhooks
- Implement signature verification
- Handle idempotency
- Queue webhook processing
- Retry failed webhooks
- Message Queue Integration
- Send and receive messages
- Handle dead letter queues
- Implement message retry logic
- Monitor queue health
- Ensure message ordering where needed
- Resilience Patterns
- Implement retry with exponential backoff
- Configure circuit breakers
- Handle timeout scenarios
- Implement fallback strategies
- Monitor integration health
Workflows
Read the matching reference when implementing — each carries the full pattern.
Call a third-party REST API
Read references/http-client-and-webhooks.md — the typed-client interface/implementation/registration trio and .AddStandardResilienceHandler retry, circuit-breaker and timeout configuration.
Receive webhooks
Read references/http-client-and-webhooks.md — the receiver endpoint (fast ack, Task.Run hand-off) and the HMAC-signature-validating, idempotency-checking processor.
Publish or consume events
Read references/message-queues.md — the Service Bus publisher and the BackgroundService consumer with dead-letter handling.
Authenticate machine-to-machine
Read references/oauth2.md — cached client-credentials token service and the DelegatingHandler that attaches the bearer token.
Handle throttling
Read references/rate-limits.md — 429 Too Many Requests, Retry-After, exponential backoff.
Load Additional Patterns
.ai/patterns/api-patterns.md
Critical Rules
HTTP Client Best Practices
- NEVER create HttpClient directly (use IHttpClientFactory)
- ALWAYS implement resilience patterns (retry, circuit breaker)
- ALWAYS validate external responses
- ALWAYS handle rate limiting
- Set appropriate timeouts
- Use typed clients for clean separation
- Mock external services in tests
Webhook Security
- ALWAYS verify webhook signatures
- ALWAYS implement idempotency
- Process webhooks asynchronously
- Respond quickly (< 3 seconds)
- Validate webhook payload schema
- Log all webhook events
Message Queue Patterns
- Use transactions where applicable
- Handle poison messages
- Implement dead letter queue processing
- Monitor queue depth
- Use message TTL appropriately
- Ensure at-least-once delivery handling
References
references/http-client-and-webhooks.md— typed HTTP clients with resilience, webhook receiver and processorreferences/message-queues.md— Azure Service Bus publisher, background-service consumer, DI registrationreferences/oauth2.md— OAuth2 client-credentials token service and delegating handlerreferences/rate-limits.md— 429 handling withRetry-Afterand exponential backoff
Common Integration Pitfalls
❌ Avoid These Mistakes
- Creating HttpClient Directly
- ❌
new HttpClient() - ✅ Use IHttpClientFactory
- No Resilience Patterns
- ❌ No retries or circuit breakers
- ✅ Add standard resilience handler
- Blocking Webhook Processing
- ❌ Processing webhook synchronously in endpoint
- ✅ Queue and process asynchronously
- Not Validating Webhook Signatures
- ❌ Trusting all incoming webhooks
- ✅ Verify HMAC signature
- Ignoring Idempotency
- ❌ Processing same webhook multiple times
- ✅ Check if already processed
- No Timeout Configuration
- ❌ Default infinite timeout
- ✅ Set appropriate timeouts
Integration Checklist
API Client
- [ ] Typed HTTP client implemented
- [ ] IHttpClientFactory used
- [ ] Resilience patterns configured
- [ ] Authentication handled
- [ ] Rate limiting handled
- [ ] Errors logged appropriately
- [ ] Timeouts configured
Webhooks
- [ ] Signature validation implemented
- [ ] Idempotency check in place
- [ ] Async processing configured
- [ ] Quick response (< 3s)
- [ ] Webhook events logged
- [ ] Retry logic for processing failures
Message Queue
- [ ] Publisher implemented
- [ ] Consumer background service created
- [ ] Dead letter queue handling
- [ ] Message retry logic
- [ ] Idempotent message handling
- [ ] Queue health monitoring
Testing
- [ ] Mock external services in tests
- [ ] Test retry scenarios
- [ ] Test timeout scenarios
- [ ] Test rate limiting
- [ ] Test webhook signature validation
Checklist Before Completion
- [ ] All external services have typed clients
- [ ] Resilience patterns implemented
- [ ] Webhook validation functional
- [ ] Message queue integration working
- [ ] Rate limiting handled
- [ ] OAuth2 token refresh working
- [ ] Error handling comprehensive
- [ ] Logging includes correlation IDs
- [ ] Integration tests passing
- [ ] Documentation complete