Hyperlinks Extension
Hyperlinks allows you to attach relevant URLs to your messages, providing direct access to builds, logs, or any other resource your team might need. This ensures that your notifications are not only informative but also actionable, enabling your team to quickly navigate to the necessary tools and information.
Configuration
Basic Syntax
json
{
"name": "hyperlinks",
"condition": "passOrFail",
"inputs": {
"links": [
{
"text": "Build Logs",
"url": "<build-logs-url>"
}
]
}
}
Parameters
links
(object[]) - List of link objectstext
(string) - Text to display for the linkurl
(string|function) - URL to link to (can be dynamic)condition
(condition) - Condition to include this link
Default Behavior
- Hook:
end
- Condition:
passOrFail
Examples
Basic Links
Simple static links to common resources:
json
{
"targets": [
{
"name": "slack",
"inputs": {
"url": "{SLACK_WEBHOOK_URL}"
}
}
],
"extensions": [
{
"name": "hyperlinks",
"inputs": {
"links": [
{
"text": "Build Logs",
"url": "https://ci.example.com/logs/{BUILD_ID}"
},
{
"text": "Test Report",
"url": "https://reports.example.com/{BUILD_ID}"
}
]
}
}
]
}
Conditional Links
Show different links based on test results:
json
{
"name": "hyperlinks",
"inputs": {
"links": [
{
"text": "Build Logs",
"url": "https://ci.example.com/logs/{BUILD_ID}"
},
{
"text": "Failure Screenshots",
"url": "https://screenshots.example.com/{BUILD_ID}",
"condition": "fail"
},
{
"text": "Coverage Report",
"url": "https://coverage.example.com/{BUILD_ID}",
"condition": "pass"
}
]
}
}
Dynamic Links with Functions
Generate URLs dynamically based on test results:
json
{
"name": "hyperlinks",
"inputs": {
"links": [
{
"text": "Build Logs",
"url": "https://ci.example.com/logs/{BUILD_ID}"
},
{
"text": "Custom Report",
"url": "async ({ result }) => { return `https://reports.example.com/${result.project}/${result.buildId}` }"
}
]
}
}
Environment-Specific Links
Different links for different environments:
json
{
"name": "hyperlinks",
"inputs": {
"links": [
{
"text": "Production Logs",
"url": "https://prod-logs.example.com/{BUILD_ID}",
"condition": "result.environment === 'production'"
},
{
"text": "Staging Logs",
"url": "https://staging-logs.example.com/{BUILD_ID}",
"condition": "result.environment === 'staging'"
},
{
"text": "Development Dashboard",
"url": "https://dev-dashboard.example.com",
"condition": "result.environment === 'development'"
}
]
}
}
Platform-Specific Output
Slack
Links appear as clickable buttons or formatted text with proper Slack link formatting.
Microsoft Teams
Links are displayed as action cards with Teams-style button formatting.
Common Use Cases
CI/CD Integration
json
{
"links": [
{
"text": "📊 Build Details",
"url": "https://ci.example.com/build/{BUILD_ID}"
},
{
"text": "📝 Build Logs",
"url": "https://ci.example.com/logs/{BUILD_ID}"
},
{
"text": "🔧 Pipeline Configuration",
"url": "https://ci.example.com/pipeline/{PIPELINE_ID}"
}
]
}
Test Reporting
json
{
"links": [
{
"text": "📈 Test Trends",
"url": "https://analytics.example.com/trends/{PROJECT_ID}"
},
{
"text": "🐛 Bug Reports",
"url": "https://bugs.example.com/project/{PROJECT_ID}",
"condition": "fail"
},
{
"text": "✅ Quality Gate",
"url": "https://quality.example.com/gate/{BUILD_ID}",
"condition": "pass"
}
]
}
Monitoring and Alerts
json
{
"links": [
{
"text": "📊 Application Metrics",
"url": "https://metrics.example.com/app/{APP_NAME}"
},
{
"text": "🚨 Error Tracking",
"url": "https://errors.example.com/project/{PROJECT_ID}",
"condition": "fail"
},
{
"text": "📱 Mobile App Store",
"url": "https://appstore.example.com/app/{APP_ID}",
"condition": "pass"
}
]
}
Related Documentation
- Metadata - Metadata configuration
- Extensions Overview - Complete extensions reference
- CI Info Extension - Add CI/CD context information
- Configuration Guide - General configuration help