1. Packages
  2. Vercel
  3. API Docs
  4. Webhook
Vercel v1.14.3 published on Monday, Oct 7, 2024 by Pulumiverse

vercel.Webhook

Explore with Pulumi AI

A webhook is a trigger-based HTTP endpoint configured to receive HTTP POST requests through events.

When an event happens, a webhook is sent to a third-party app, which can then take appropriate action.

Only Pro and Enterprise teams are able to configure these webhooks at the account level.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as vercel from "@pulumiverse/vercel";

const example = new vercel.Project("example", {});
const example2 = new vercel.Project("example2", {});
const withProjectIds = new vercel.Webhook("withProjectIds", {
    events: [
        "deployment.created",
        "deployment.succeeded",
    ],
    endpoint: "https://example.com/endpoint",
    projectIds: [
        example.id,
        example2.id,
    ],
});
const withoutProjectIds = new vercel.Webhook("withoutProjectIds", {
    events: [
        "deployment.created",
        "deployment.succeeded",
    ],
    endpoint: "https://example.com/endpoint",
});
Copy
import pulumi
import pulumiverse_vercel as vercel

example = vercel.Project("example")
example2 = vercel.Project("example2")
with_project_ids = vercel.Webhook("withProjectIds",
    events=[
        "deployment.created",
        "deployment.succeeded",
    ],
    endpoint="https://example.com/endpoint",
    project_ids=[
        example.id,
        example2.id,
    ])
without_project_ids = vercel.Webhook("withoutProjectIds",
    events=[
        "deployment.created",
        "deployment.succeeded",
    ],
    endpoint="https://example.com/endpoint")
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-vercel/sdk/go/vercel"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := vercel.NewProject(ctx, "example", nil)
		if err != nil {
			return err
		}
		example2, err := vercel.NewProject(ctx, "example2", nil)
		if err != nil {
			return err
		}
		_, err = vercel.NewWebhook(ctx, "withProjectIds", &vercel.WebhookArgs{
			Events: pulumi.StringArray{
				pulumi.String("deployment.created"),
				pulumi.String("deployment.succeeded"),
			},
			Endpoint: pulumi.String("https://example.com/endpoint"),
			ProjectIds: pulumi.StringArray{
				example.ID(),
				example2.ID(),
			},
		})
		if err != nil {
			return err
		}
		_, err = vercel.NewWebhook(ctx, "withoutProjectIds", &vercel.WebhookArgs{
			Events: pulumi.StringArray{
				pulumi.String("deployment.created"),
				pulumi.String("deployment.succeeded"),
			},
			Endpoint: pulumi.String("https://example.com/endpoint"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vercel = Pulumiverse.Vercel;

return await Deployment.RunAsync(() => 
{
    var example = new Vercel.Project("example");

    var example2 = new Vercel.Project("example2");

    var withProjectIds = new Vercel.Webhook("withProjectIds", new()
    {
        Events = new[]
        {
            "deployment.created",
            "deployment.succeeded",
        },
        Endpoint = "https://example.com/endpoint",
        ProjectIds = new[]
        {
            example.Id,
            example2.Id,
        },
    });

    var withoutProjectIds = new Vercel.Webhook("withoutProjectIds", new()
    {
        Events = new[]
        {
            "deployment.created",
            "deployment.succeeded",
        },
        Endpoint = "https://example.com/endpoint",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vercel.Project;
import com.pulumi.vercel.Webhook;
import com.pulumi.vercel.WebhookArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Project("example");

        var example2 = new Project("example2");

        var withProjectIds = new Webhook("withProjectIds", WebhookArgs.builder()
            .events(            
                "deployment.created",
                "deployment.succeeded")
            .endpoint("https://example.com/endpoint")
            .projectIds(            
                example.id(),
                example2.id())
            .build());

        var withoutProjectIds = new Webhook("withoutProjectIds", WebhookArgs.builder()
            .events(            
                "deployment.created",
                "deployment.succeeded")
            .endpoint("https://example.com/endpoint")
            .build());

    }
}
Copy
resources:
  example:
    type: vercel:Project
  example2:
    type: vercel:Project
  withProjectIds:
    type: vercel:Webhook
    properties:
      events:
        - deployment.created
        - deployment.succeeded
      endpoint: https://example.com/endpoint
      projectIds:
        - ${example.id}
        - ${example2.id}
  withoutProjectIds:
    type: vercel:Webhook
    properties:
      events:
        - deployment.created
        - deployment.succeeded
      endpoint: https://example.com/endpoint
Copy

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,
            endpoint: Optional[str] = None,
            events: Optional[Sequence[str]] = None,
            project_ids: Optional[Sequence[str]] = None,
            team_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: vercel: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 Vercel.Webhook("webhookResource", new()
{
    Endpoint = "string",
    Events = new[]
    {
        "string",
    },
    ProjectIds = new[]
    {
        "string",
    },
    TeamId = "string",
});
Copy
example, err := vercel.NewWebhook(ctx, "webhookResource", &vercel.WebhookArgs{
	Endpoint: pulumi.String("string"),
	Events: pulumi.StringArray{
		pulumi.String("string"),
	},
	ProjectIds: pulumi.StringArray{
		pulumi.String("string"),
	},
	TeamId: pulumi.String("string"),
})
Copy
var webhookResource = new Webhook("webhookResource", WebhookArgs.builder()
    .endpoint("string")
    .events("string")
    .projectIds("string")
    .teamId("string")
    .build());
Copy
webhook_resource = vercel.Webhook("webhookResource",
    endpoint="string",
    events=["string"],
    project_ids=["string"],
    team_id="string")
Copy
const webhookResource = new vercel.Webhook("webhookResource", {
    endpoint: "string",
    events: ["string"],
    projectIds: ["string"],
    teamId: "string",
});
Copy
type: vercel:Webhook
properties:
    endpoint: string
    events:
        - string
    projectIds:
        - string
    teamId: 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:

Endpoint This property is required. string
Webhooks events will be sent as POST requests to this URL.
Events This property is required. List<string>
A list of the events the webhook will listen to. At least one must be present.
ProjectIds List<string>
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
TeamId string
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
Endpoint This property is required. string
Webhooks events will be sent as POST requests to this URL.
Events This property is required. []string
A list of the events the webhook will listen to. At least one must be present.
ProjectIds []string
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
TeamId string
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
endpoint This property is required. String
Webhooks events will be sent as POST requests to this URL.
events This property is required. List<String>
A list of the events the webhook will listen to. At least one must be present.
projectIds List<String>
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
teamId String
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
endpoint This property is required. string
Webhooks events will be sent as POST requests to this URL.
events This property is required. string[]
A list of the events the webhook will listen to. At least one must be present.
projectIds string[]
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
teamId string
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
endpoint This property is required. str
Webhooks events will be sent as POST requests to this URL.
events This property is required. Sequence[str]
A list of the events the webhook will listen to. At least one must be present.
project_ids Sequence[str]
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
team_id str
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
endpoint This property is required. String
Webhooks events will be sent as POST requests to this URL.
events This property is required. List<String>
A list of the events the webhook will listen to. At least one must be present.
projectIds List<String>
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
teamId String
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Secret string
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
Id string
The provider-assigned unique ID for this managed resource.
Secret string
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
id String
The provider-assigned unique ID for this managed resource.
secret String
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
id string
The provider-assigned unique ID for this managed resource.
secret string
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
id str
The provider-assigned unique ID for this managed resource.
secret str
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
id String
The provider-assigned unique ID for this managed resource.
secret String
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.

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,
        endpoint: Optional[str] = None,
        events: Optional[Sequence[str]] = None,
        project_ids: Optional[Sequence[str]] = None,
        secret: Optional[str] = None,
        team_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: vercel: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:
Endpoint string
Webhooks events will be sent as POST requests to this URL.
Events List<string>
A list of the events the webhook will listen to. At least one must be present.
ProjectIds List<string>
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
Secret string
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
TeamId string
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
Endpoint string
Webhooks events will be sent as POST requests to this URL.
Events []string
A list of the events the webhook will listen to. At least one must be present.
ProjectIds []string
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
Secret string
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
TeamId string
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
endpoint String
Webhooks events will be sent as POST requests to this URL.
events List<String>
A list of the events the webhook will listen to. At least one must be present.
projectIds List<String>
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
secret String
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
teamId String
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
endpoint string
Webhooks events will be sent as POST requests to this URL.
events string[]
A list of the events the webhook will listen to. At least one must be present.
projectIds string[]
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
secret string
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
teamId string
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
endpoint str
Webhooks events will be sent as POST requests to this URL.
events Sequence[str]
A list of the events the webhook will listen to. At least one must be present.
project_ids Sequence[str]
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
secret str
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
team_id str
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.
endpoint String
Webhooks events will be sent as POST requests to this URL.
events List<String>
A list of the events the webhook will listen to. At least one must be present.
projectIds List<String>
A list of project IDs that the webhook should be associated with. These projects should send events to the specified endpoint.
secret String
A secret value which will be provided in the x-vercel-signature header and can be used to verify the authenticity of the webhook. See https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks for further details.
teamId String
The ID of the team the Webhook should exist under. Required when configuring a team resource if a default team has not been set in the provider.

Package Details

Repository
vercel pulumiverse/pulumi-vercel
License
Apache-2.0
Notes
This Pulumi package is based on the vercel Terraform Provider.