- create - Create trigger
- list - List triggers
- get - Get trigger
- update - Update trigger
- delete - Delete trigger
- search_events - Search events for a trigger
- list_presets - List trigger presets
- get_preset - Get trigger preset
- list_preset_input_values - Search trigger preset input values
- search_preset_events - Search events for a trigger preset
Create a trigger from a preset and return it with its signing secret.
from glean.api_client import Glean, models
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.create(preset_id="GITHUB_1", delivery={
"webhook_url": "https://customer.app/webhook",
"auth": {
"type": models.PlatformTriggerAuthType.BEARER,
"secret": "secret_test_123",
},
}, description="Reviews I am tagged on, sent to my team's review channel", inputs={
"repository": "acme/payments-api",
})
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
preset_id |
str | ✔️ | ID of the preset to instantiate. | GITHUB_1 |
delivery |
models.PlatformTriggerDelivery | ✔️ | N/A | |
description |
Optional[str] | ➖ | Optional note describing this trigger. | Reviews I am tagged on, sent to my team's review channel |
inputs |
Dict[str, Any] | ➖ | Values for the preset's inputs. | { "repository": "acme/payments-api" } |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerCreateResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 409, 413, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
List triggers owned by the authenticated caller.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.list(page_size=50)
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
page_size |
Optional[int] | ➖ | Maximum number of triggers to return. |
cursor |
Optional[str] | ➖ | Opaque pagination cursor from a previous response. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerListResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 408, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
Retrieve a trigger owned by the authenticated caller.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.get(trigger_id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
trigger_id |
str | ✔️ | ID of the trigger to retrieve. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerGetResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
Update a trigger.
from glean.api_client import Glean, models
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.update(trigger_id="<id>", status=models.PlatformTriggerStatus.ENABLED, description="Reviews I am tagged on, sent to my team's review channel", inputs={
"repository": "acme/payments-api",
}, delivery={
"webhook_url": "https://customer.app/webhook",
"auth": {
"type": models.PlatformTriggerAuthType.BEARER,
"secret": "secret_test_123",
},
})
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
trigger_id |
str | ✔️ | ID of the trigger to update. | |
status |
Optional[models.PlatformTriggerStatus] | ➖ | Current trigger lifecycle state. | ENABLED |
description |
Optional[str] | ➖ | Optional note describing this trigger. | Reviews I am tagged on, sent to my team's review channel |
inputs |
Dict[str, Any] | ➖ | Values for the preset's inputs. | { "repository": "acme/payments-api" } |
delivery |
Optional[models.PlatformTriggerDelivery] | ➖ | N/A | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerGetResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 413, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
Delete a trigger.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
glean.triggers.delete(trigger_id="<id>")
# Use the SDK ...| Parameter | Type | Required | Description |
|---|---|---|---|
trigger_id |
str | ✔️ | ID of the trigger to delete. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
Search recent content events an existing trigger matches. Read-only — no webhook delivery is made. Covers the last seven days.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.search_events(trigger_id="<id>", page_size=10)
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
trigger_id |
str | ✔️ | ID of the trigger whose events to search. |
page_size |
Optional[int] | ➖ | Maximum number of events to return. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerEventSearchResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 413, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
List the trigger presets available to the caller. A preset is a curated content-trigger template (e.g. a new Jira ticket) which is passed when creating a trigger.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.list_presets(page_size=50)
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
datasource |
Optional[str] | ➖ | Restrict results to presets for a single datasource (e.g. github). |
page_size |
Optional[int] | ➖ | Maximum number of presets to return. |
cursor |
Optional[str] | ➖ | Opaque pagination cursor from a previous response. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerPresetListResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 408, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
Retrieve a single trigger preset by id.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.get_preset(preset_id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
preset_id |
str | ✔️ | ID of the preset to retrieve. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerPresetGetResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
Return up to 300 selectable values for a single picklist input on a preset. Results are intended for typeahead selection and are not cursor-paginated. When is_truncated is true, refine query to narrow the result set.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.list_preset_input_values(preset_id="<id>", field="<value>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
preset_id |
str | ✔️ | ID of the preset the input belongs to. |
field |
str | ✔️ | Field identifier of the input whose values to list. |
query |
Optional[str] | ➖ | Prefix filter over the input's option values, for typeahead. Matching is on the option value, not its display name. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerPresetInputValueListResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |
Search recent content events an unsaved trigger built from this preset would match, to preview it before creating the trigger. Read-only — no trigger is created and no webhook delivery is made. Covers the last seven days.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.triggers.search_preset_events(preset_id="<id>", inputs={
"repository": "acme/payments-api",
}, page_size=10)
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
preset_id |
str | ✔️ | ID of the preset to preview. | |
inputs |
Dict[str, str] | ➖ | Values for the preset's input fields, keyed by field name. |
{ "repository": "acme/payments-api" } |
page_size |
Optional[int] | ➖ | Maximum number of events to return. | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PlatformTriggerEventSearchResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 413, 429 | application/problem+json |
| errors.PlatformProblemDetailError | 500, 503 | application/problem+json |
| errors.GleanError | 4XX, 5XX | */* |