Links

WayScript SDK

Your Lairs have exclusive access to the WayScript SDK, which offers a the following packages to help with tool development:
  • wayscript.context - access process execution metadata, such as event payload
  • wayscript.triggers - call trigger-specific methods
  • wayscript.secret_manager - update secrets in your vault

Python

wayscript.context

from wayscript import context
Method
Description
Parameters
Return Type
context.get_event()
Get request event payload
<none>
dict
context.get_lair()
Get Lair name
<none>
dict
context.get_lair_trigger()
Get trigger name
<none>
dict
context.get_lair_url()
Get default lair endpoint
<none>
str
context.get_process()
Get process id
<none>
dict
context.get_user_by_application_key(<application_key>)
Get metadata for workspace member from application key
application_key: str
dict
context.get_workspace()
Get Workspace name
<none>
dict
The get_user_by_application_key method requires fetching the application key from the header of the request made to your Lair. We provide an example on how to access the request header in your tool.

wayscript.triggers

import wayscript.triggers as triggers
Method
Description
Parameters
Return Type
triggers.http_trigger.send_response(data, headers, status_code)
Return response to endpoint generated by http trigger Example: send response to http trigger
  • data: dict (json) or other specified type
  • headers: dict
  • status_code: int
dict

wayscript.secret_manager

from wayscript import secret_manager
Method
Description
Parameters
Return Type
secret_manager.set_secret(<key>, <value>)
Set the value of a lair secret
  • key: str
  • value: str
None

JavaScript

const wayscript = require("wayscript");

wayscript.context

Method
Description
Parameters
Return Type
context.getEvent()
Get event payload
<none>
object
context.getLair()
Get Lair name
<none>
object
context.getLairTrigger()
Get trigger name
<none>
object
context.getLairUrl()
Get default lair endpoint
<none>
string
context.getProcess()
Get process id
<none>
object
context.getUserByApplicationKey(<application_key>)
Get metadata for workspace member from application key
application_key: string
object
context.getWorkspace()
Get Workspace name
<none>
object
The getUserByApplicationKey method requires fetching the application key from the header of the request made to your Lair. We provide an example on how to access the request header in your tool.
wayscript.http_trigger
Method
Description
Parameters
Return Type
http_trigger.sendResponse(data, headers, status_code)
Return response to endpoint generated by http trigger Example: send response to http trigger
  • data: object (json) or other specified type
  • headers: object
  • status_code: number
object

wayscript.secret_manager

Method
Description
Parameters
Return Type
secret_manager.setSecret(<key>, <value>)
Set the value of a lair secret
  • key: string
  • value: string
undefined

Golang

We are working on creating a Go SDK. In the meantime, code snippets for common WayScript methods can be found here: https://github.com/wayscript/wayscript-golang