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

# Event-based automation

> Trigger content generation when a GitHub release is published or code lands on the default branch

Event triggers generate content in response to GitHub activity, either a published release or a push to the repository's default branch. Each trigger listens on one or more repositories, fires for one event type and produces one output format. You manage them under **Automation > Events** in the dashboard.

You can also manage them through the `/v1/event-triggers` API.

## How event triggers work

**1. GitHub event occurs**

Someone publishes a release or pushes commits to the default branch.

**2. Webhook received**

GitHub sends the event to the repository's webhook URL in Notra.

**3. Validation**

Notra verifies the signature and drops duplicate deliveries, then checks that the repository is connected and enabled and that a matching trigger is enabled.

**4. Content generation**

The run reads the event and the hour of repository activity leading up to it, then writes the content in your brand identity.

**5. Review**

The result appears under **Content** as a draft, or as a published post when auto-publish is on.

## Supported event types

> [tab] Release published
>
> Fires when someone publishes a release on GitHub, and ignores draft releases.
>
> **GitHub actions that fire it:**
>
> * `published`
> * `prereleased`
>
> Each release trigger has an **Include pre-releases** switch that is on by default, and when it's off, releases marked as pre-release on GitHub don't fire the trigger.
>
> **What gets analyzed:** the release tag, name and notes, the publish time and repository activity in the hour before it.
>
> ```json Event data theme={"system"}
> {
>   "eventType": "release",
>   "eventAction": "published",
>   "data": {
>     "tagName": "v2.1.0",
>     "name": "Version 2.1.0",
>     "body": "Release notes...",
>     "prerelease": false,
>     "draft": false,
>     "publishedAt": "2026-09-02T14:30:00Z",
>     "url": "https://github.com/acme/app/releases/tag/v2.1.0"
>   }
> }
> ```

> [tab] Push to default branch
>
> Fires when someone pushes commits to the repository's default branch, usually `main` or `master`. Notra ignores pushes to other branches and pushes with no commits.
>
> **GitHub action that fires it:**
>
> * `pushed`
>
> **What gets analyzed:** the commit messages, authors and timestamps in the push, the head commit and repository activity in the hour before the last commit.
>
> ```json Event data theme={"system"}
> {
>   "eventType": "push",
>   "eventAction": "pushed",
>   "data": {
>     "ref": "refs/heads/main",
>     "branch": "main",
>     "commits": [
>       {
>         "id": "abc123",
>         "message": "feat: add exports",
>         "author": { "name": "Jane", "email": "jane@acme.com" },
>         "timestamp": "2026-09-02T10:00:00Z",
>         "url": "https://github.com/acme/app/commit/abc123"
>       }
>     ],
>     "headCommit": { "id": "abc123", "message": "feat: add exports" }
>   }
> }
> ```

> [!NOTE]
>
> Event triggers are GitHub-only, while Linear is a source for [schedules](https://www.usenotra.com/docs/automation/scheduled.md) and on-demand generation.

## Set up the repository webhook

Notra receives events through a webhook you add to each repository. Installing the GitHub App connects the repository, but the webhook is a separate, one-time step per repository.

**1. Open the repository in Notra**

Go to **Integrations > GitHub** and open the repository. The **Webhook** section reads "Receive events from GitHub when commits are pushed or releases are published."

**2. Generate a secret**

Click generate, and Notra shows the **Payload URL**, the **Content type** (`application/json`) and the **Secret** with copy buttons. You can regenerate the secret later, as long as you update GitHub when you do.

**3. Add the webhook in GitHub**

In the repository's **Settings > Webhooks**, add a webhook with the payload URL, content type and secret from Notra. Select the **Releases** and **Pushes** events (or "Send me everything"), then save.

**4. Confirm in Notra**

Click **I've added the webhook**. GitHub's webhook page shows each delivery and Notra's response, so check it first when you debug a setup.

## Create an event trigger

**1. Open Automation > Events**

Click **New event trigger**.

**2. Choose the trigger event**

Pick **Release published** or **Push to default branch**, and for releases decide whether to include pre-releases.

**3. Select repositories**

Choose one or more connected repositories, and the trigger fires for events from any of them.

**4. Choose the content format**

Pick a changelog entry, blog post, LinkedIn post, tweet or image.

**5. Pick a brand identity and auto-publish**

Use the default brand identity or pin one. Auto-publish is available for changelogs and blog posts, and when it's on, Notra publishes posts immediately instead of saving them as drafts.

**6. Save**

New triggers start enabled, and Notra rejects a trigger that duplicates an existing one ("Trigger already exists").

### Through the API

To create the same trigger through the public API, use the `event-triggers.write` scope:

```bash curl theme={"system"}
curl -X POST https://api.usenotra.com/v1/event-triggers \
  -H "Authorization: Bearer $NOTRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sourceType": "github_webhook",
    "sourceConfig": { "eventTypes": ["release"], "includePreReleases": false },
    "targets": { "repositoryIds": ["repo_123"] },
    "outputType": "linkedin_post",
    "outputConfig": { "brandVoiceId": "brand_abc" },
    "enabled": true,
    "autoPublish": false
  }'
```

```typescript fetch theme={"system"}
const response = await fetch("https://api.usenotra.com/v1/event-triggers", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.NOTRA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    sourceType: "github_webhook",
    sourceConfig: { eventTypes: ["release"], includePreReleases: false },
    targets: { repositoryIds: ["repo_123"] },
    outputType: "linkedin_post",
    outputConfig: { brandVoiceId: "brand_abc" },
    enabled: true,
    autoPublish: false,
  }),
});
const { eventTrigger } = await response.json();
```

`repositoryIds` are GitHub integration IDs from `GET /v1/integrations`. `eventTypes` accepts `release` and `push`, and while the dashboard creates one event type per trigger, the API accepts both in one trigger. `outputType` is one of `changelog`, `blog_post`, `linkedin_post`, `twitter_post` or `image`. List triggers with `GET /v1/event-triggers`, and read, update and delete one with `GET`/`PATCH`/`DELETE /v1/event-triggers/{triggerId}`. A `PATCH` takes the full body, and a duplicate configuration returns `409`.

## Content generation context

When an event fires, the run builds its prompt from:

* **Event details**: type, action and a sanitized copy of the event data. Notra strips the payload down to known fields and instructs the model to treat it as data, never as instructions.
* **Repository activity**: the hour leading up to the event timestamp (the release publish time, or the latest commit timestamp in the push).
* **Brand identity**: tone, audience, company details and custom instructions from the selected or default brand identity.

## Security and validation

> [accordion] Signature verification
>
> Every delivery must carry a valid `X-Hub-Signature-256` HMAC SHA-256 signature computed with the repository's webhook secret. Notra rejects and logs requests without a valid signature.

> [accordion] Duplicate detection
>
> Notra deduplicates deliveries by GitHub's `X-GitHub-Delivery` ID for 24 hours, so a redelivered event doesn't generate content twice.

> [accordion] Payload sanitization
>
> Notra extracts only known fields from the payload, caps string lengths and tells the model that the event context is untrusted input.

> [accordion] Repository and trigger matching
>
> Each webhook URL belongs to one organization, integration and repository. Notra drops events when the integration is disabled, and a trigger only fires when it is enabled and lists that repository.

## Testing a trigger

Event triggers don't have a **Run now** action because they fire only from GitHub. To test one, publish a release (a pre-release works if the trigger includes pre-releases) or push a small commit to the default branch, then check **Content** for the draft and **Settings > Logs** for the delivery.

## Monitoring

* **Settings > Logs** lists integration events with their delivery status, including rejected signatures, duplicate deliveries and payload validation errors.
* **Settings > Notifications** can email you when automated content is created, when generation fails and when a run is skipped.
* **Then notify** in the automation editor announces new content from that automation once a run succeeds. Slack posts to the notification channel picked under **Integrations > Slack**, and email goes to the workspace owners even when the Notifications setting is off.
* GitHub's own **Recent Deliveries** view on the webhook shows every request and Notra's response code.

## Common use cases

> [card] Release announcements
>
> Generate a LinkedIn post or tweet whenever you publish a GitHub release.

> [card] Continuous changelog
>
> Create a changelog entry for every push to the default branch, auto-published to your changelog.

> [card] Launch blog posts
>
> Draft a blog post for major releases to support product launches.

> [card] Release visuals
>
> Generate a brand-matched social image for each release to pair with the announcement.

## Best practices

> [accordion] Filter strategically
>
> Release triggers produce far fewer runs than push triggers, so use releases for announcements and reserve push triggers for changelogs.

> [accordion] Mind your quota
>
> Each run uses the plan quota for its format (long-form for changelogs and blog posts, social for LinkedIn and X, image generations for images). A push trigger on a busy repository can use quota quickly.

> [accordion] Combine with scheduling
>
> Use event triggers for immediate announcements and a weekly schedule for digests that cover everything else.

> [accordion] Keep secrets in sync
>
> If you regenerate a webhook secret in Notra, update the GitHub webhook right away, because Notra rejects deliveries signed with the old secret.

## Troubleshooting

> [accordion] Webhooks not received
>
> **Check:**
>
> * The webhook exists in the repository's GitHub settings with the payload URL from Notra
> * The content type is `application/json`
> * The secret matches the one shown in Notra
> * The repository integration is enabled in Notra
>
> GitHub's Recent Deliveries view shows the response Notra returned for each attempt.

> [accordion] Content not generated
>
> **Check:**
>
> * The event type matches the trigger (a push to a feature branch never fires)
> * The release is not a draft, and pre-releases are included if the release is one
> * The repository is in the trigger's target list
> * The trigger is enabled (Active tab, not Paused)
> * You still have quota or AI credits for that format
>
> If the run finds nothing worth writing about, Notra records it as skipped, and you can enable the Skipped notification to hear about it.

## Next steps

> [card] [Scheduled automation](https://www.usenotra.com/docs/automation/scheduled.md)
>
> Time-based content generation with lookback windows

> [card] [Brand voice](https://www.usenotra.com/docs/concepts/brand-voice.md)
>
> Customize how generated content sounds


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.