1. Packages
  2. Prefect Provider
  3. API Docs
  4. Webhook
prefect 2.24.1 published on Tuesday, Apr 15, 2025 by prefecthq

prefect.Webhook

Explore with Pulumi AI

The resource webhook represents a Prefect Cloud Webhook. Webhooks allow external services to trigger events in Prefect. For more information, see receive events with webhooks.

This feature is available in the following product plan(s): Prefect Cloud (Free), Prefect Cloud (Pro), Prefect Cloud (Enterprise).

Create Webhook Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Webhook(name: string, args: WebhookArgs, opts?: CustomResourceOptions);
@overload
def Webhook(resource_name: str,
            args: WebhookArgs,
            opts: Optional[ResourceOptions] = None)

@overload
def Webhook(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            template: Optional[str] = None,
            account_id: Optional[str] = None,
            description: Optional[str] = None,
            enabled: Optional[bool] = None,
            name: Optional[str] = None,
            service_account_id: Optional[str] = None,
            workspace_id: Optional[str] = None)
func NewWebhook(ctx *Context, name string, args WebhookArgs, opts ...ResourceOption) (*Webhook, error)
public Webhook(string name, WebhookArgs args, CustomResourceOptions? opts = null)
public Webhook(String name, WebhookArgs args)
public Webhook(String name, WebhookArgs args, CustomResourceOptions options)
type: prefect:Webhook
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var webhookResource = new Prefect.Webhook("webhookResource", new()
{
    Template = "string",
    AccountId = "string",
    Description = "string",
    Enabled = false,
    Name = "string",
    ServiceAccountId = "string",
    WorkspaceId = "string",
});
Copy
example, err := prefect.NewWebhook(ctx, "webhookResource", &prefect.WebhookArgs{
Template: pulumi.String("string"),
AccountId: pulumi.String("string"),
Description: pulumi.String("string"),
Enabled: pulumi.Bool(false),
Name: pulumi.String("string"),
ServiceAccountId: pulumi.String("string"),
WorkspaceId: pulumi.String("string"),
})
Copy
var webhookResource = new Webhook("webhookResource", WebhookArgs.builder()
    .template("string")
    .accountId("string")
    .description("string")
    .enabled(false)
    .name("string")
    .serviceAccountId("string")
    .workspaceId("string")
    .build());
Copy
webhook_resource = prefect.Webhook("webhookResource",
    template="string",
    account_id="string",
    description="string",
    enabled=False,
    name="string",
    service_account_id="string",
    workspace_id="string")
Copy
const webhookResource = new prefect.Webhook("webhookResource", {
    template: "string",
    accountId: "string",
    description: "string",
    enabled: false,
    name: "string",
    serviceAccountId: "string",
    workspaceId: "string",
});
Copy
type: prefect:Webhook
properties:
    accountId: string
    description: string
    enabled: false
    name: string
    serviceAccountId: string
    template: string
    workspaceId: string
Copy

Webhook Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Webhook resource accepts the following input properties:

Template This property is required. string
Template used by the webhook
AccountId string
Account ID (UUID), defaults to the account set in the provider
Description string
Description of the webhook
Enabled bool
Whether the webhook is enabled
Name string
Name of the webhook
ServiceAccountId string
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
WorkspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider
Template This property is required. string
Template used by the webhook
AccountId string
Account ID (UUID), defaults to the account set in the provider
Description string
Description of the webhook
Enabled bool
Whether the webhook is enabled
Name string
Name of the webhook
ServiceAccountId string
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
WorkspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider
template This property is required. String
Template used by the webhook
accountId String
Account ID (UUID), defaults to the account set in the provider
description String
Description of the webhook
enabled Boolean
Whether the webhook is enabled
name String
Name of the webhook
serviceAccountId String
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
workspaceId String
Workspace ID (UUID), defaults to the workspace set in the provider
template This property is required. string
Template used by the webhook
accountId string
Account ID (UUID), defaults to the account set in the provider
description string
Description of the webhook
enabled boolean
Whether the webhook is enabled
name string
Name of the webhook
serviceAccountId string
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
workspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider
template This property is required. str
Template used by the webhook
account_id str
Account ID (UUID), defaults to the account set in the provider
description str
Description of the webhook
enabled bool
Whether the webhook is enabled
name str
Name of the webhook
service_account_id str
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
workspace_id str
Workspace ID (UUID), defaults to the workspace set in the provider
template This property is required. String
Template used by the webhook
accountId String
Account ID (UUID), defaults to the account set in the provider
description String
Description of the webhook
enabled Boolean
Whether the webhook is enabled
name String
Name of the webhook
serviceAccountId String
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
workspaceId String
Workspace ID (UUID), defaults to the workspace set in the provider

Outputs

All input properties are implicitly available as output properties. Additionally, the Webhook resource produces the following output properties:

Created string
Timestamp of when the resource was created (RFC3339)
Endpoint string
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
Id string
The provider-assigned unique ID for this managed resource.
Updated string
Timestamp of when the resource was updated (RFC3339)
Created string
Timestamp of when the resource was created (RFC3339)
Endpoint string
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
Id string
The provider-assigned unique ID for this managed resource.
Updated string
Timestamp of when the resource was updated (RFC3339)
created String
Timestamp of when the resource was created (RFC3339)
endpoint String
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
id String
The provider-assigned unique ID for this managed resource.
updated String
Timestamp of when the resource was updated (RFC3339)
created string
Timestamp of when the resource was created (RFC3339)
endpoint string
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
id string
The provider-assigned unique ID for this managed resource.
updated string
Timestamp of when the resource was updated (RFC3339)
created str
Timestamp of when the resource was created (RFC3339)
endpoint str
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
id str
The provider-assigned unique ID for this managed resource.
updated str
Timestamp of when the resource was updated (RFC3339)
created String
Timestamp of when the resource was created (RFC3339)
endpoint String
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
id String
The provider-assigned unique ID for this managed resource.
updated String
Timestamp of when the resource was updated (RFC3339)

Look up Existing Webhook Resource

Get an existing Webhook resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: WebhookState, opts?: CustomResourceOptions): Webhook
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        created: Optional[str] = None,
        description: Optional[str] = None,
        enabled: Optional[bool] = None,
        endpoint: Optional[str] = None,
        name: Optional[str] = None,
        service_account_id: Optional[str] = None,
        template: Optional[str] = None,
        updated: Optional[str] = None,
        workspace_id: Optional[str] = None) -> Webhook
func GetWebhook(ctx *Context, name string, id IDInput, state *WebhookState, opts ...ResourceOption) (*Webhook, error)
public static Webhook Get(string name, Input<string> id, WebhookState? state, CustomResourceOptions? opts = null)
public static Webhook get(String name, Output<String> id, WebhookState state, CustomResourceOptions options)
resources:  _:    type: prefect:Webhook    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccountId string
Account ID (UUID), defaults to the account set in the provider
Created string
Timestamp of when the resource was created (RFC3339)
Description string
Description of the webhook
Enabled bool
Whether the webhook is enabled
Endpoint string
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
Name string
Name of the webhook
ServiceAccountId string
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
Template string
Template used by the webhook
Updated string
Timestamp of when the resource was updated (RFC3339)
WorkspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider
AccountId string
Account ID (UUID), defaults to the account set in the provider
Created string
Timestamp of when the resource was created (RFC3339)
Description string
Description of the webhook
Enabled bool
Whether the webhook is enabled
Endpoint string
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
Name string
Name of the webhook
ServiceAccountId string
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
Template string
Template used by the webhook
Updated string
Timestamp of when the resource was updated (RFC3339)
WorkspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider
accountId String
Account ID (UUID), defaults to the account set in the provider
created String
Timestamp of when the resource was created (RFC3339)
description String
Description of the webhook
enabled Boolean
Whether the webhook is enabled
endpoint String
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
name String
Name of the webhook
serviceAccountId String
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
template String
Template used by the webhook
updated String
Timestamp of when the resource was updated (RFC3339)
workspaceId String
Workspace ID (UUID), defaults to the workspace set in the provider
accountId string
Account ID (UUID), defaults to the account set in the provider
created string
Timestamp of when the resource was created (RFC3339)
description string
Description of the webhook
enabled boolean
Whether the webhook is enabled
endpoint string
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
name string
Name of the webhook
serviceAccountId string
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
template string
Template used by the webhook
updated string
Timestamp of when the resource was updated (RFC3339)
workspaceId string
Workspace ID (UUID), defaults to the workspace set in the provider
account_id str
Account ID (UUID), defaults to the account set in the provider
created str
Timestamp of when the resource was created (RFC3339)
description str
Description of the webhook
enabled bool
Whether the webhook is enabled
endpoint str
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
name str
Name of the webhook
service_account_id str
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
template str
Template used by the webhook
updated str
Timestamp of when the resource was updated (RFC3339)
workspace_id str
Workspace ID (UUID), defaults to the workspace set in the provider
accountId String
Account ID (UUID), defaults to the account set in the provider
created String
Timestamp of when the resource was created (RFC3339)
description String
Description of the webhook
enabled Boolean
Whether the webhook is enabled
endpoint String
The fully-formed webhook endpoint, eg. https://api.prefect.cloud/hooks/<slug>
name String
Name of the webhook
serviceAccountId String
ID of the Service Account to which this webhook belongs. Pro and Enterprise customers can assign a Service Account to a webhook to enhance security. If set, the webhook request will be authorized with the Service Account's API key.
template String
Template used by the webhook
updated String
Timestamp of when the resource was updated (RFC3339)
workspaceId String
Workspace ID (UUID), defaults to the workspace set in the provider

Import

Prefect Webhooks can be imported using the webhook_id

$ pulumi import prefect:index/webhook:Webhook example 11111111-1111-1111-1111-111111111111
Copy

or from a different workspace via the webhook_id,workspace_id

$ pulumi import prefect:index/webhook:Webhook example 11111111-1111-1111-1111-111111111111,00000000-0000-0000-0000-000000000000
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
prefect prefecthq/terraform-provider-prefect
License
Notes
This Pulumi package is based on the prefect Terraform Provider.