ZapierToolkit

class ZapierToolkit(BaseToolkit):

A class representing a toolkit for interacting with Zapier’s NLA API.

This class provides methods for executing Zapier actions through natural language commands, allowing integration with various web services and automation of workflows through the Zapier platform.

Attributes: api_key (str): The API key for authenticating with Zapier’s API. base_url (str): The base URL for Zapier’s API endpoints. timeout (Optional[float]): The timeout value for API requests in seconds. If None, no timeout is applied. (default: :obj:None)

init

def __init__(self, timeout: Optional[float] = None):

list_actions

def list_actions(self):

Returns:

Dict[str, Any]: A dictionary containing the list of available actions.

execute_action

def execute_action(self, action_id: str, instructions: str):

Execute a specific Zapier action using natural language instructions.

Parameters:

  • action_id (str): The ID of the Zapier action to execute.
  • instructions (str): Natural language instructions for executing the action. For example: “Send an email to john@example.com with subject ‘Hello’ and body ‘How are you?’”

Returns:

Dict[str, Any]: The result of the action execution, including status and any output data.

preview_action

def preview_action(self, action_id: str, instructions: str):

Preview a specific Zapier action using natural language instructions.

Parameters:

  • action_id (str): The ID of the Zapier action to preview.
  • instructions (str): Natural language instructions for previewing the action. For example: “Send an email to john@example.com with subject ‘Hello’ and body ‘How are you?’”

Returns:

Dict[str, Any]: The preview result showing what parameters would be used if the action were executed.

get_execution_result

def get_execution_result(self, execution_id: str):

Get the execution result of a Zapier action.

Parameters:

  • execution_id (str): The execution ID returned from execute_action.

Returns:

Dict[str, Any]: The execution result containing status, logs, and any output data from the action execution.

get_tools

def get_tools(self):

Returns:

List[FunctionTool]: A list of FunctionTool objects representing the functions in the toolkit.