> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tutorial: Registry artifact alias automation

> Build an automation that runs a webhook when a Registry artifact gets a specific alias like "production".

This tutorial walks you through building a **registry** automation triggered by artifact metadata: when an artifact in your registry gets a specific alias (for example, **production**), W\&B sends a `POST` request to your webhook. Use this pattern to notify downstream systems like deployment pipelines, paging services, or notification channels, whenever you promote a model to a known stage. This tutorial is intended for ML engineers and MLOps practitioners who manage model lifecycles in W\&B Registry.

<br />

<br />

```mermaid theme={null}
flowchart LR
  Event[Artifact alias added]
  Action[Webhook]
  Event --> Action
```

<br />

<Tip>For guidance creating a project automation, see [Tutorial: Project run-failure alert automation](/models/automations/project-automation-tutorial).</Tip>

## Prerequisites

* A [webhook](/models/automations/create-automations/webhook#create-a-webhook) configured in **Team Settings**.
* A W\&B [registry](/models/registry/create_registry) with at least one collection, or reuse an existing registry.

## Create a registry automation

Set up a registry-scoped automation so that when an artifact in any collection in the registry gets a specific alias (for example, **production**), W\&B sends a `POST` request to your webhook.

1. Open the registry and click the **Automations** tab, then click **Create automation**.
2. Choose the event **An artifact alias is added**. Enter an **Alias regex** that matches the alias you care about (for example, **production** or **staging**).
3. Click **Next step**. Set **Action type** to **Webhooks** and select your webhook. If the webhook expects a payload, paste a JSON body and use [payload variables](/models/automations/create-automations/webhook#payload-variables) such as `${artifact_collection_name}` and `${artifact_version_string}`.
4. Click **Next step**. Give the automation a name and optional description, then click **Create automation**.

For more information, see [Create a webhook automation](/models/automations/create-automations/webhook#create-an-automation) (Registry tab).

## Test the automation

To confirm that the automation fires end-to-end, trigger the configured event by adding the alias to an artifact version. Add the alias (for example, **production**) to an artifact version in the registry, using the W\&B App or the public API. For example:

```python theme={null}
import wandb

with wandb.init(project="my-project") as run:
    artifact = wandb.Artifact("my-model", type="model")
    # ... log files or metadata to artifact as needed ...
    run.log_artifact(artifact)
    run.wait()  # Ensure the artifact is logged before proceeding

# Add an alias to the latest version in the collection
api = wandb.Api()
collection = api.artifact_collection(name="my-model", type_name="model")
version = next(collection.versions())  # Get the latest version

version.aliases.append("production")
version.save()
print("Added alias 'production' to", version.name)

```

Within a short time, your webhook endpoint receives a `POST` with the payload you configured. You now have a working registry automation that fires whenever a matching alias is applied to an artifact in this registry.

## Go further

For more information, see the following resources:

* [Automation events and scopes](/models/automations/automation-events) for all project and registry event types.
* [Create a Slack automation](/models/automations/create-automations/slack) and [Create a webhook automation](/models/automations/create-automations/webhook) for full UI and payload details.
