Pre-defined Actions

Pre-defined Actions

Admyral provides pre-defined actions to enable you to get started quickly. They are out-of-the-box actions to facilitate the creation of automations.

Within your coded automations, you can use pre-defined actions directly within the @workflow function.

Send Email

Send emails as part of an automation.

ParameterTypeDescription
recipientsstr | list[str]The email addresses of the recipient(s). For a single recipient, either use a list of strings or just a string. For multiple recipients, use a list of strings.
sender_namestrThe name of the sender. This name will appear in the "From" field of the email.
subjectstrThe subject of the email. This will be displayed in the subject line of the email.
bodystrThe body of the email. This is the main content of the email message.

Response: The response from the resend.Emails.send() method, typically a JSON object indicating the status of the email sending operation.

from admyral.workflow import workflow
from admyral.typings import JsonValue
from admyral.actions import send_email
 
@workflow
def example_workflow(payload: dict[str, JsonValue]): # previous workflow logic
  # multiple recipients
  email = send_email(
    recipients=["daniel@admyral.dev", "chris@admyral.dev"],
    sender_name="Admyral",
    subject="Admyral Documentation",
    body="Hi there, This is for documentation purposes. Cheers!"
  )
 
  # Single recipient
  email = send_email(
    recipients="daniel@admyral.dev",
    sender_name="Admyral",
    subject="Admyral Documentation",
    body="Hi there, This is for documentation purposes. Cheers!"
  )

If-Condition

Create if-branches within your automations.

The following Python for if-conditions is currently supported:

  • Binary Operators: ==, !=, <, <=, >, >=, in
  • Unary Operators: not, is None, is not None

You can construct condition expressions of the following types:

  • Using truthy and falsy values
    Falsy Values: empty lists [], empty dicts {}, empty tuples (), empty strings "", None, False, integer zero 0
    All other values are considered to be truthy
  • Unary Expression: not Expression, Expression is None, Expression is not None
    Example: not payload["some_value"]
  • Binary Expression: Expression Binary Operator Expression
    Example: payload["url"] == "https://admyral.dev"
  • Combine conidtion expressions using and, or together with parenthesis (...) for ensuring correct precedence:
    Example: payload["url"] == "https://admyral.dev" or (payload["values"][0] > 0 and payload["values"][1] <= 10)

No-Code: The No-Code editor expects the same syntax except for accessing variables. There, you must use references. See the No-Code Editor for more information about references.

Simply stick with the python-based if-statements.

from admyral.workflow import workflow
from admyral.typings import JsonValue
 
@workflow
def example_workflow(payload: dict[str, JsonValue]):
    # previous workflow logic
    if payload["url"] == "https://admyral.dev":
        # do this
    else:
        # to that

For Loops

Coming soon...

AI Action

Use advanced AI models to perform complex tasks, such as categorization, analysis, summarization, or decision support. The pre-defined AI Action only supports OpenAI's latest models provided by Admyral (Cloud version only). To use other models or use your own API keys use the corresponding integration action of providers like OpenAI, Mistral AI, Anthropic, or Azure OpenAI.

ParameterTypeDescriptionRequired/Optional
modelLiteralThe model to use for the AI action. Options include "gpt-4", "gpt-4o", "gpt-4-turbo".Required
promptstrThe prompt to use for the AI action. This will be the input text that the model processes.Required
top_pfloat or NoneValue between 0 and 1. An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with Top P probability mass.Optional
temperaturefloat or NoneSampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.Optional

Response: The generated response from the AI model based on the provided prompt and parameters as a str.

from admyral.workflow import workflow
from admyral.typings import JsonValue
from admyral.actions import ai_action
 
@workflow
def example_workflow(payload: dict[str, JsonValue]):
    # previous workflow logic incl. a request to VirusTotal saved in `virustotal`
    ai_action(
        model="gpt-4o",
        prompt=f"summarize the findings from virustotal: {virustotal.output}"
    )

Transform

Manipulate existing data or create new JSON within your workflows.

Recommended Use Cases:

  • Define constants
  • Extract data from previous events
  • Set up new JSON data (JSON object, array, int, float, boolean, null, string)
ParameterTypeDescriptionRequired/Optional
valueJSONYour constructed JSON dataRequired
from admyral.workflow import workflow
from admyral.typings import JsonValue
from admyral.actions import transform
 
@workflow
def example_workflow(payload: dict[str, JsonValue]):
    # previous workflow logic incl. a request to VirusTotal saved in `virustotal`
 
    # Define constants
    my_constant = transform(value="constant value")
 
    # Extract values and assign to a variable
    key = transform(value=payload["key"])
 
    # Build new JSON data
    headers = transform(
      value={
        "Content-Type": "application/json",
        "Authorization": f"Bearer {key}"
      }
    )

Deserialize JSON String

Deserializes a JSON String.

ParameterTypeDescriptionRequired/Optional
serialized_jsonstrThe string to be deserialized.Required

Response: The deserialized JSON.

from admyral.workflow import workflow
from admyral.typings import JsonValue
from admyral.actions import deserialize_json_string
 
@workflow
def example_workflow(payload: dict[str, JsonValue]):
    # previous workflow logic incl. a serialized JSON string saved in `example_string`
    value = deserialize_json_string(
        serialized_json="{\"foo\": [1, 4, 7, 10], \"bar\": \"baz\"}"
    )

Serialize JSON String

Serializes JSON into a string.

ParameterTypeDescriptionRequired/Optional
json_valuestrThe object to be serialized.Required

Response: The serialized JSON string.

from admyral.workflow import workflow
from admyral.typings import JsonValue
from admyral.actions import serialize_json_string
 
@workflow
def example_workflow(payload: dict[str, JsonValue]):
    # previous workflow logic incl. a serialized JSON string saved in `example_string`
    value = serialize_json_string(
        json_value={
          "foo": [1, 4, 7, 10],
          "bar": "baz"
        }
    )