# Workflow Triggers

### 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

```python
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

```python
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**

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

Modify the details of an existing activity.

#### Fetching an Activity Object

```python
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

```python
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)**

```python
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**

```python
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.

***

{% hint style="info" %}
**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.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shimoku.com/dev/advanced-usage/workflow-triggers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
