pydo.functions.create_trigger()
Generated on 21 Jan 2026
from pydo version
v0.24.0
Description
Creates a new trigger for a given function in a namespace. To create a trigger, send a POST request to /v2/functions/namespaces/$NAMESPACE_ID/triggers with the name, function, type, is_enabled and scheduled_details properties.
Parameters
| Name | Type | Required | Description | Default Value |
|---|---|---|---|---|
namespace_id |
string | True | The ID of the namespace to be managed. | |
body |
JSON or IO[bytes] | True |
Request Sample
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
req = {
"name": "my trigger",
"function": "hello",
"type": "SCHEDULED",
"is_enabled": True,
"scheduled_details": {
"cron": "* * * * *",
"body": {
"name": "Welcome to DO!"
}
}
}
resp = client.functions.create_trigger(namespace_id="aff93af3", body=req)More Information
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.