An action is a task performed within a workflow, using one of the connections you’ve set up.

Action types

Strada-defined action

A pre-configured action which simplifies a commonly used task for a given connection. For example, the Send Message action for Slack.

Custom HTTP action

Allow you to make a request to the connection’s underlying API.

Strada makes it easy to create these requests by presenting the endpoint’s query, headers, and body visually.

Using actions in your code

All actions are instances of class which inherit from the following definition:

class StradaFunction():
    def __init__(self, function_name: str):
        self.function_name = function_name

    def execute(self, **kwargs):
        raise NotImplementedError

Therefore, every Strada action has a .execute() method that is used to invoke the action in the code.

Specifying parameters

Parameters can be provided as keyword arguments (**kwargs) within the execute method

For example, for a workflow with a Send Message Slack action called SendMsg, with a custom parameter called message, the .execute() method can be called as follows:

SendMsg.execute(message="Message sent to Slack channel")
Strada parameters are defined as keyword arguments (**kwargs) and not arguments (*args). Therefore, specifyingActionName.execute(param="Value") is valid, but specifying ActionName.execute("Value") is not.

Action responses

All Strada actions have the following Pydantic model as a response:

class StradaResponse(BaseModel):
    error: Optional[StradaError] = None
    success: bool
    data: Optional[Any] = None

The data attribute will have a different model based on the app (i.e. Slack, Jira) and action (i.e. send message, create ticket). You can view the exact documentation for the schema responses for all apps and actions in Integrations.

All responses are subscriptable, meaning you can access any value using the following two ways:

r = SendMessage.execute(message="Hello, world!")

if (r.success == True):
  print("Hoorah!")

OR

r = SendMessage.execute(message="Hello, world!")

if (r['success'] == True):
  print("Hoorah!")

Example

In the screenshot below, the SendMessage sends a message that is based on the parameter name using the Slack API.

To invoke this action in your workflow use:

r = SendMessage.execute(name="Adam")