Table of Contents

Last updated

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. For integrations that call Windshift over HTTP instead of running inside a plugin, start with the REST API overview.

Logging

log

Write a message to the Windshift server log.

Parameters:

  • level - Log level: debug, info, warn, error
  • message - 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 URL
  • method - 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
}

Email

smtp_send

Send an email through the configured SMTP server.

Parameters:

  • to - Recipient email addresses
  • subject - Email subject
  • body - 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 key
  • value - 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 ID
  • content - Comment text (supports markdown)

SCM (Source Code Management)

scm_create_branch

Create a new branch in a linked repository.

Parameters:

  • repository - Repository identifier
  • branch_name - Name for the new branch
  • base_branch - Base branch to create from

Link a work item to an SCM resource (branch, PR, commit).

Parameters:

  • item_id - The work item ID
  • resource_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 execute
  • args - Command arguments (array of strings)

Returns: Command output (stdout)

Note: Plugin timeout limits apply to command execution. The default limit is five seconds. An administrator must enable Plugin CLI Command Execution under Admin > Security before a plugin can run commands. Windshift limits commands to the plugin directory.

Function Summary

FunctionCategoryDescription
logLoggingWrite to server log
http_fetchHTTPMake HTTP requests
smtp_sendEmailSend emails via SMTP
kv_getStorageRead from key-value store
kv_setStorageWrite to key-value store
kv_deleteStorageDelete from key-value store
create_commentItemsAdd comment to work item
scm_create_branchSCMCreate repository branch
scm_create_item_linkSCMLink item to SCM resource
cli_execCLIExecute system command