Async Events
Trigger scripts asynchronously via Forge Queue. One per script (singleton).
Async events are triggered from scripts using asyncEvent.push(scriptId, payload?, options?) or asyncEvent.pushSelf(payload?, options?). The target script must have an enabled async event trigger - otherwise events are discarded.
Event Variable
The event variable in the target script contains:
| Property | Type | Description |
|---|---|---|
event.payload |
object | Data passed by the sender (empty object if not provided) |
event.source |
string | "script" |
event.pushedBy |
string | Account ID of the sender |
event.pushedAt |
number | Timestamp in milliseconds |
event.scriptId |
string | UUID of the current script |
event.issueKey |
string/null | Issue key (e.g. "PROJ-123") or null |
event.depth |
number | Current chain depth (0 = initial trigger) |
event.chainId |
string | UUID identifying the event chain (for tracing) |
Automatic context: When
issueKeyis provided via options, the runtime variablesissueandissueKeyare set automatically in the target script.
Options
| Option | Type | Description |
|---|---|---|
issueKey |
string | Issue key in PROJ-123 format, passed as context to the target script |
delayInSeconds |
number | Delay before processing (0-900, max 15 minutes) |
Return Value
Both push() and pushSelf() return { jobId: string }.
Limits
| Limit | Value |
|---|---|
Max push/pushSelf calls per execution |
10 |
Max push/pushSelf calls per execution (chained, depth > 0) |
3 |
| Max payload size | 100KB |
| Max delay | 900 seconds (15 minutes) |
| Max chain depth | 1 (allows 2 hops: depth 0, 1) |
Fanout reduction: Chained executions (depth > 0) are limited to 3 push calls instead of 10, reducing worst-case total executions.
Example
Sender script - pushes an event to a target script:
// Push with payload and issue context
await asyncEvent.push(
"550e8400-e29b-41d4-a716-446655440000",
{ action: "process", itemId: 42 },
{ issueKey: "PROJ-123", delayInSeconds: 60 }
)
Target script (must have an async event trigger enabled):
log("Received from:", event.pushedBy)
log("Depth:", event.depth, "Chain:", event.chainId)
if (event.payload.action === "process") {
// issueKey was passed in options, so issue is auto-loaded
log("Processing:", issueKey, "-", issue.fields.summary)
}
See the Async Event API for the full scripting reference.
See Also
- Triggers Overview - All trigger types at a glance
- Scheduled Triggers - Run scripts on a schedule
- Event Triggers - React to Jira events
