Workflow Triggers

External webhook functionalities

Overview

Shimoku introduces a powerful feature: Workflow Triggers, which seamlessly connect to External Webhooks. This functionality allows Shimoku to invoke external processes — akin to a workflow — using the "Activities" module.


Activities & Runs

  1. Activity: Think of an "Activity" as a container. It holds a webhook (an external URL that gets pinged) and the settings that dictate how that webhook behaves.

  2. Run: Each time an "Activity" is executed, a "Run" is created. This "Run" is the unique instance of that execution. It will have its settings, plus a log that keeps track of any information from the remotely executed process.


Working with Activities

Creating an Activity

s.activities.create_activity(
    name: str,
    settings: Optional[dict] = None
) -> Dict

This function sets up an activity with a specified name and settings.

Deleting an Activity

s.activities.delete_activity(
    uuid: Optional[str] = None,
    name: Optional[str] = None
)

As the name implies, this function removes a specific activity.

Updating Activity Metadata

s.activities.update_activity(
    uuid: Optional[str] = None,
    name: Optional[str] = None
)

Modify the details of an existing activity.

Fetching an Activity Object

s.activities.get_activity(
    uuid: Optional[str] = None,
    name: Optional[str] = None,
    pretty_print: bool = False,
    how_many_runs: Optional[int] = None
) -> Dict

Retrieve information on a specific activity.


Webhooks

Creating a Webhook for an Activity

s.activities.create_webhook(
    url: str,
    uuid: Optional[str] = None,
    name: Optional[str] = None,
    method: str = 'GET',
    headers: Optional[dict] = None
)

Use this to add a webhook to an activity. The webhook will be the URL triggered when the activity is run.

Runs & Logs

Executing an Activity (Creates & Executes a Run)

s.activities.execute_activity(
    uuid: Optional[str] = None,
    name: Optional[str] = None,
    run_settings: Optional[Union[dict, str]] = None
)

Launch a specific activity, which subsequently triggers the associated webhook.

Fetching Logs of a Run

s.activities.get_run_logs(
    run_id: str, uuid: Optional[str] = None,
    name: Optional[str] = None
)

Retrieve the logs linked to a particular activity's run.


Note: Before working with these methods, ensure you've set the menu path using s.set_menu_path. This organizes the activities within distinct navigation paths in your app.

Last updated