---
title: "Deploy Cron Trigger External Webhook URL"
description: "Call external webhook URL with auth header tokens via Cron Schedule"
category: "Automation"
url: https://railway.com/deploy/cron-trigger-external-webhook-url
---

# Deploy Cron Trigger External Webhook URL

Call external webhook URL with auth header tokens via Cron Schedule

**[Deploy Cron Trigger External Webhook URL on Railway](https://railway.com/template/cron-trigger-external-webhook-url)**

- **Creator:** My Projects
- **Category:** Automation
- **Total deploys:** 1

## Template content

### Bun Function

- **Image:** ghcr.io/railwayapp/function-bun:1.3.0
- **Start command:** `./run.sh Y29uc3QgY3JvblNlY3JldCA9IHByb2Nlc3MuZW52LkNST05fU0VDUkVUOwpjb25zdCBlbmRwb2ludFVybCA9IHByb2Nlc3MuZW52LkNST05fRU5EUE9JTlRfVVJMOwoKaWYgKCFjcm9uU2VjcmV0IHx8ICFlbmRwb2ludFVybCkgewogIGNvbnNvbGUuZXJyb3IoCiAgICBKU09OLnN0cmluZ2lmeSh7CiAgICAgIGxldmVsOiAiZXJyb3IiLAogICAgICBtZXNzYWdlOiAiQ1JPTl9TRUNSRVQgYW5kIEVORFBPSU5UX1VSTCBtdXN0IGJlIHNldCIsCiAgICB9KQogICk7CiAgcHJvY2Vzcy5leGl0KDEpOwp9Cgp0cnkgewogIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgZmV0Y2goZW5kcG9pbnRVcmwsIHsKICAgIG1ldGhvZDogIlBPU1QiLAogICAgaGVhZGVyczogewogICAgICBBdXRob3JpemF0aW9uOiBgQmVhcmVyICR7Y3JvblNlY3JldH1gLAogICAgICAiQ29udGVudC1UeXBlIjogImFwcGxpY2F0aW9uL2pzb24iLAogICAgfSwKICB9KTsKCiAgbGV0IGRhdGEgPSBudWxsOwogIGNvbnN0IGNvbnRlbnRUeXBlID0gcmVzcG9uc2UuaGVhZGVycy5nZXQoImNvbnRlbnQtdHlwZSIpOwogIGlmIChjb250ZW50VHlwZSAmJiBjb250ZW50VHlwZS5pbmNsdWRlcygiYXBwbGljYXRpb24vanNvbiIpKSB7CiAgICB0cnkgewogICAgICBkYXRhID0gYXdhaXQgcmVzcG9uc2UuanNvbigpOwogICAgfSBjYXRjaCB7CiAgICAgIGRhdGEgPSB7IHJhdzogYXdhaXQgcmVzcG9uc2UudGV4dCgpIH07CiAgICB9CiAgfSBlbHNlIHsKICAgIGRhdGEgPSB7IHJhdzogYXdhaXQgcmVzcG9uc2UudGV4dCgpIH07CiAgfQoKICBjb25zb2xlLmxvZygKICAgIEpTT04uc3RyaW5naWZ5KHsKICAgICAgbGV2ZWw6IHJlc3BvbnNlLm9rID8gImluZm8iIDogImVycm9yIiwKICAgICAgbWVzc2FnZTogcmVzcG9uc2Uub2sgPyAiQ3JvbiBqb2IgY29tcGxldGVkIiA6ICJDcm9uIGpvYiBmYWlsZWQiLAogICAgICBzdGF0dXM6IHJlc3BvbnNlLnN0YXR1cywKICAgICAgZGF0YSwKICAgIH0pCiAgKTsKCiAgaWYgKCFyZXNwb25zZS5vaykgewogICAgcHJvY2Vzcy5leGl0KDEpOwogIH0KfSBjYXRjaCAoZXJyb3IpIHsKICBjb25zb2xlLmxvZygKICAgIEpTT04uc3RyaW5naWZ5KHsKICAgICAgbGV2ZWw6ICJlcnJvciIsCiAgICAgIG1lc3NhZ2U6ICJDcm9uIGpvYiBmYWlsZWQiLAogICAgICBlcnJvcjogZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yLm1lc3NhZ2UgOiAiVW5rbm93biBlcnJvciIsCiAgICB9KQogICk7CiAgcHJvY2Vzcy5leGl0KDEpOwp9Cg==`

## Documentation

# Deploy and Host Cron Trigger External Webhook URL on Railway

A lightweight Bun function that triggers HTTP endpoints on a schedule using Bearer token authentication. Perfect for running scheduled tasks, triggering webhooks, or pinging external APIs securely without managing infrastructure.

## About Hosting Cron Trigger External Webhook URL

This template deploys a minimal Bun function on Railway that calls a configured endpoint with a `CRON_SECRET` Bearer token for authentication. The function runs on Railway's cron scheduler, which you configure in the Settings tab after deployment. All logs are structured JSON for easy debugging in Railway's log viewer. Simply set your environment variables, configure your cron schedule, and your endpoint will be called automatically at your specified interval.

## Common Use Cases

- Triggering scheduled jobs on external APIs or your own services
- Pinging health check endpoints at regular intervals
- Running periodic data sync or cleanup tasks on remote servers

## Dependencies for Cron Trigger External Webhook URL Hosting

- `CRON_SECRET` - A secure token used in the Authorization Bearer header
- `ENDPOINT_URL` - The URL to call when the cron job runs

### Deployment Dependencies

- https://bun.sh/
- https://docs.railway.com/reference/cron-jobs

### Implementation Details 

After deploying, you must configure the cron schedule in the Settings tab of your service. Set the schedule using standard cron syntax (e.g., 0 * * * * for hourly, */15 * * * * for every 15 minutes).

The function logs all responses as structured JSON:
```
{
  "level": "info",
  "message": "Cron job completed",
  "status": 200,
  "data": { ... }
}
```

## Why Deploy Cron Trigger External Webhook URL on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Cron Trigger External Webhook URL on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Build a WhatsApp automation platform with Evolution API, n8n & Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

Open this page in a browser: https://railway.com/deploy/cron-trigger-external-webhook-url
