Przejdź do głównej zawartości

Action Buttons

Add clickable action buttons to your messages that open URLs, trigger webhooks, or launch apps.

Two Methods

Notifer supports two ways to add action buttons:

MethodUse CaseHeaders
SimpleSingle link buttonX-URL, X-URL-Title
AdvancedMultiple buttons, custom actionsX-Actions or JSON body

For a single action button, use the X-URL header:

curl -d "Build #1234 completed successfully" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "X-URL: https://ci.example.com/builds/1234" \
-H "X-URL-Title: View Build" \
https://app.notifer.io/ci-notifications

Headers

HeaderRequiredMax LengthDescription
X-URLYes512 charsURL to open when button is clicked
X-URL-TitleNo100 charsButton label (defaults to "Open Link")

Supported URL Schemes

  • https:// - Web links (recommended)
  • http:// - Unencrypted web links
  • tel: - Phone numbers (tel:+1234567890)
  • mailto: - Email addresses (mailto:support@example.com)
  • slack:// - Slack deep links
  • sms: - SMS messages

Examples

Link to dashboard:

curl -d "New order received: #12345" \
-H "X-URL: https://dashboard.example.com/orders/12345" \
-H "X-URL-Title: View Order" \
https://app.notifer.io/orders

Phone call action:

curl -d "Urgent: Server room temperature critical!" \
-H "X-Priority: 1" \
-H "X-URL: tel:+1555123456" \
-H "X-URL-Title: Call On-Call Engineer" \
https://app.notifer.io/alerts

Email action:

curl -d "Weekly report is ready" \
-H "X-URL: mailto:team@example.com?subject=Weekly%20Report" \
-H "X-URL-Title: Email Team" \
https://app.notifer.io/reports

Advanced Method (Multiple Actions)

For multiple buttons or advanced actions, use the X-Actions header or JSON body.

Action Types

TypeDescriptionExample
viewOpens URL in browser/appOpen dashboard, view logs
httpSends HTTP requestApprove/reject, trigger webhook
broadcastAndroid broadcast intentAndroid app integration

X-Actions Header Format

action, label, url[, param=value]...

Multiple actions separated by semicolon (;):

curl -d "Deployment ready for review" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "X-Actions: view, View Changes, https://github.com/org/repo/pull/123; view, Open Jenkins, https://jenkins.example.com/job/123" \
https://app.notifer.io/deployments

JSON Body Format

For complex actions, use JSON:

curl -X POST https://app.notifer.io/deployments \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "Deployment ready for approval",
"title": "Deploy v2.1.0",
"actions": [
{
"action": "view",
"label": "View Changes",
"url": "https://github.com/org/repo/pull/123"
},
{
"action": "view",
"label": "Approve",
"url": "https://deploy.example.com/approve/123"
},
{
"action": "view",
"label": "Reject",
"url": "https://deploy.example.com/reject/123"
}
]
}'

Action Object Properties

PropertyRequiredDescription
actionYesAction type: view, http, or broadcast
labelYesButton text (max 40 chars)
urlYesTarget URL (max 512 chars)
methodNoHTTP method for http type (GET, POST, etc.)
headersNoCustom headers for http type
bodyNoRequest body for http type
clearNoClear notification after action (boolean)

HTTP Action Example

Trigger a webhook when button is clicked:

curl -X POST https://app.notifer.io/approvals \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "PR #456 needs approval",
"actions": [
{
"action": "http",
"label": "Approve PR",
"url": "https://api.example.com/pr/456/approve",
"method": "POST",
"headers": {
"Authorization": "Bearer webhook_token"
},
"body": "{\"approved\": true}",
"clear": true
},
{
"action": "view",
"label": "View PR",
"url": "https://github.com/org/repo/pull/456"
}
]
}'

Real-World Examples

CI/CD Pipeline

curl -d "Build failed on main branch" \
-H "X-Priority: 2" \
-H "X-Actions: view, View Logs, https://ci.example.com/builds/789/logs; view, Retry Build, https://ci.example.com/builds/789/retry; view, View Commit, https://github.com/org/repo/commit/abc123" \
https://app.notifer.io/ci-alerts

E-commerce Order

curl -X POST https://app.notifer.io/orders \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "New order #12345 - $299.00",
"title": "New Order",
"priority": 3,
"actions": [
{
"action": "view",
"label": "View Order",
"url": "https://admin.shop.com/orders/12345"
},
{
"action": "view",
"label": "Customer Profile",
"url": "https://admin.shop.com/customers/678"
}
]
}'

Incident Response

curl -d "CRITICAL: Database connection pool exhausted" \
-H "X-Priority: 1" \
-H "X-Title: Database Alert" \
-H "X-Actions: view, Grafana Dashboard, https://grafana.example.com/d/db-metrics; view, Restart Service, https://ops.example.com/restart/db-pool; tel, Call DBA, tel:+1555987654" \
https://app.notifer.io/incidents

Approval Workflow

curl -X POST https://app.notifer.io/approvals \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "Expense report from John Smith - $1,250.00",
"title": "Expense Approval Required",
"actions": [
{
"action": "http",
"label": "Approve",
"url": "https://api.company.com/expenses/999/approve",
"method": "POST",
"clear": true
},
{
"action": "http",
"label": "Reject",
"url": "https://api.company.com/expenses/999/reject",
"method": "POST",
"clear": true
},
{
"action": "view",
"label": "View Details",
"url": "https://expenses.company.com/reports/999"
}
]
}'

Display

Action buttons appear in:

  • Web Dashboard - Message detail view and preview panel
  • Mobile Apps - Message detail screen
  • Push Notifications - As interactive buttons (iOS/Android)

Buttons are displayed horizontally and wrap to next line if needed.


Best Practices

1. Keep Labels Short

Button labels should be concise (2-3 words):

  • Good: "View Logs", "Approve", "Open Dashboard"
  • Bad: "Click here to view the build logs"

2. Limit Number of Actions

Recommend 2-4 actions maximum. Too many buttons can be overwhelming.

3. Order by Importance

Place the most important/common action first (leftmost).

4. Use Clear Action Names

Use verbs that describe the action:

  • "View", "Open", "Approve", "Reject", "Call", "Email"

5. Consider Mobile Users

  • Buttons should be tappable on mobile
  • Test URLs work on both desktop and mobile
  • Use tel: and mailto: for phone/email actions

Response Format

When you publish a message with actions, they're included in the response:

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"topic": "deployments",
"message": "Deployment ready",
"title": "Deploy v2.1.0",
"priority": 3,
"actions": [
{
"action": "view",
"label": "View Changes",
"url": "https://github.com/org/repo/pull/123"
},
{
"action": "view",
"label": "Approve",
"url": "https://deploy.example.com/approve/123"
}
],
"url": null,
"url_title": null,
"timestamp": "2025-01-31T10:30:00Z"
}
Simple vs Advanced

If you use both X-URL and X-Actions, the actions array takes precedence and url/url_title are ignored.


Next Steps