Cortex Webhook Documentation
Automate everything by connecting Cortex to your favorite services.
What is a Webhook?
A webhook is a mechanism for sending automated messages from one app to another. When a rule you've created in Cortex is triggered, Cortex sends the notification's data to a URL you provide. This allows you to connect Cortex to thousands of services like IFTTT, Zapier, Home Assistant, or your own custom servers to create powerful automations.
How It Works
The process is straightforward:
- In the Cortex app, navigate to Settings -> Webhooks and create a new webhook by giving it a name and providing the destination URL.
- Create or edit a rule.
- Add the "Trigger Webhook" action to your rule and select the webhook you just created.
- When that rule's conditions are met by an incoming notification,
Cortex will send an HTTP
POSTrequest with a JSON payload to your specified URL.
Your service should be prepared to receive a POST request with a Content-Type
of application/json.
The Payload
The JSON payload contains detailed information about the notification that triggered the rule. Below is a breakdown of each field in the payload.
| Field Name | Type | Description |
|---|---|---|
internalId |
String | A unique UUID generated by Cortex for this notification record in the database. |
sbnKey |
String | The original system key for the notification. Useful for performing actions on the original notification. |
deterministicKey |
String | A key combining the sbnKey and timestamp, used internally to prevent duplicate processing. |
conversationId |
String | Null | A Cortex-generated ID to group conversational notifications (e.g., chats). Formatted as "packageName|senderName". |
groupKey |
String | Null | The native Android group key for the notification. |
isGroupSummary |
Boolean | True if the original notification was a system-generated group summary. |
isLatestInConversation |
Boolean | True if this is the most recent message in its conversation/group at the time of processing. |
packageName |
String | The package name of the source application (e.g., com.whatsapp). |
appName |
String | The display name of the source application (e.g., "WhatsApp"). |
timestamp |
Integer | The Unix timestamp in milliseconds when the notification was posted. |
title |
String | The primary title of the notification (e.g., sender's name in a chat). |
content |
String | The main text content of the notification. |
bigText |
String | Null | The expanded, multi-line text content, if available. |
template |
String | Null | The Android notification template used (e.g.,
android.app.Notification$MessagingStyle).
|
duplicateCount |
Integer | How many times an identical notification has been received in a short period. Greater than 1 indicates a duplicate. |
category |
String | Null | The Android notification category (e.g., msg, email,
call).
|
actionsJson |
String (JSON) | Null | A JSON string representing the available actions (buttons) on the original notification. |
summary |
String | Null | The AI-generated summary of the notification. Null if AI processing was not performed. |
importance |
String | Null | The AI-determined importance level (critical, high,
medium, low). Null if AI processing was not performed.
|
winningRulesJson |
String (JSON) | Null | A JSON string map of winning action types to the rule ID that triggered them. |
senderAvatar |
String (Base64) | Null | A Base64-encoded string of the sender's avatar image (PNG format), typically for chat notifications. |
Example Payload
Below is an example of the JSON payload you can expect to receive. This is the same payload sent when you use the "Send Test Notification" button in the app.
{
"internalId": "test-webhook-...",
"sbnKey": "xyz.moyelauncher.cortex|0|test_notification|10101",
"deterministicKey": "xyz.moyelauncher.cortex|0|test_notification|10101_1678886400000",
"conversationId": "test-conversation",
"groupKey": "test-group",
"isGroupSummary": false,
"isLatestInConversation": true,
"packageName": "xyz.moyelauncher.cortex",
"appName": "Cortex (Test)",
"timestamp": 1678886400000,
"title": "Test Webhook",
"content": "This is a test notification from Cortex.",
"bigText": "This is the expanded content of the test notification to show how larger text fields are handled.",
"template": null,
"duplicateCount": 1,
"category": "test",
"actionsJson": "[{\"title\":\"Action 1\",\"isReply\":false},{\"title\":\"Reply\",\"isReply\":true,\"placeholder\":\"Type here...\"}]",
"picturePath": null,
"accentColor": null,
"senderAvatar": null,
"summary": "Test summary from Cortex",
"importance": "high",
"autoReplyContent": null,
"winningRulesJson": "{\"triggerWebhook\": \"test-rule-id\"}",
"model": "test-model",
"hash": null,
"processingStatus": "SUCCESS",
"dismissedTimestamp": null,
"dismissalReason": null
}
Security & Best Practices
- Use HTTPS: Always use URLs that start with
https://to ensure your notification data is encrypted in transit. - Use a Testing Service: When setting up a new webhook, use a service like webhook.site to inspect the payload and verify that Cortex is sending data correctly.
- Respond Quickly: Your webhook endpoint should respond with a success status code
(e.g.,
200 OK) as quickly as possible. Perform any long-running tasks asynchronously in the background after sending the response. This prevents timeouts and ensures Cortex knows the webhook was received. - Secure Your Endpoint: If your endpoint is public, consider implementing a secret
key in the URL (e.g.,
https://your.service/hook?secret=...) to verify that incoming requests are from a trusted source.