Plugin API
Windshift exposes host functions that plugins use to interact with the platform. All WASM plugins can use them through the Extism host function interface.
Logging
log
Write a message to the Windshift server log.
Parameters:
level- Log level:debug,info,warn,errormessage- The log message
Example:
log("info", "Processing webhook payload")
log("error", "Failed to parse response")HTTP
http_fetch
Make an HTTP request to an external service.
Parameters:
url- The request URLmethod- HTTP method (GET, POST, PUT, DELETE, etc.)headers- Request headers (JSON object)body- Request body (string)timeout- Request timeout in seconds
Returns: Response body as a string
Example:
{
"url": "https://api.example.com/webhook",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token123"
},
"body": "{\"event\": \"task.completed\"}",
"timeout": 10
}smtp_send
Send an email through the configured SMTP server.
Parameters:
to- Recipient email addressessubject- Email subjectbody- Email body (HTML or plain text)
The SMTP connection uses the server-level SMTP configuration. Plugins do not provide SMTP credentials.
Key-Value Storage
Each plugin has persistent storage. Its data survives server restarts.
kv_get
Retrieve a value by key.
Parameters:
key- The storage key
Returns: The stored value, or empty if not found
kv_set
Store a value.
Parameters:
key- The storage keyvalue- The value to store
kv_delete
Remove a stored value.
Parameters:
key- The storage key to delete
Work Items
create_comment
Add a comment to a work item.
Parameters:
item_id- The work item IDcontent- Comment text (supports markdown)
SCM (Source Code Management)
scm_create_branch
Create a new branch in a linked repository.
Parameters:
repository- Repository identifierbranch_name- Name for the new branchbase_branch- Base branch to create from
scm_create_item_link
Link a work item to an SCM resource (branch, PR, commit).
Parameters:
item_id- The work item IDresource_type- Type of SCM resource (branch, pull_request, commit)resource_url- URL of the SCM resource
CLI
cli_exec
Execute a CLI command on the server.
Parameters:
command- The command to executeargs- Command arguments (array of strings)
Returns: Command output (stdout)
Note: Plugin timeout limits apply to command execution. The default limit is five seconds.
Function Summary
| Function | Category | Description |
|---|---|---|
log |
Logging | Write to server log |
http_fetch |
HTTP | Make HTTP requests |
smtp_send |
Send emails via SMTP | |
kv_get |
Storage | Read from key-value store |
kv_set |
Storage | Write to key-value store |
kv_delete |
Storage | Delete from key-value store |
create_comment |
Items | Add comment to work item |
scm_create_branch |
SCM | Create repository branch |
scm_create_item_link |
SCM | Link item to SCM resource |
cli_exec |
CLI | Execute system command |