# A daily panchang workflow in n8n with the HTTP Request node

> n8n has no AstroNode node, and does not need one: the HTTP Request node calls the API directly. This workflow runs every morning, fetches the day's panchang for one city and hands the fields to whatever node posts your message - Slack, Telegram, email.

Source: https://astronode.dev/integrations/n8n · Updated: 2026-12-01

**How this page was verified:** n8n was not run. The exact request the node sends (method, URL, header, JSON body) was executed with curl against the in-memory API, as was the string-typed body that produces the 400 below.

## The workflow

- **Schedule Trigger** - every day at 05:30 in the workflow's timezone.
- **HTTP Request** - `POST https://api.astronode.dev/v1/panchang` (configured below).
- **Your messaging node** - builds the text from the HTTP Request node's output.

## Configuring the HTTP Request node

*HTTP Request node settings*

| Setting | Value |
| --- | --- |
| Method | `POST` |
| URL | `https://api.astronode.dev/v1/panchang` |
| Authentication | Generic Credential Type → **Header Auth** |
| Header Auth credential | Name `Authorization`, Value `Bearer aie_live_...` |
| Send Body | on, Body Content Type **JSON**, Specify Body **Using JSON** |
| Settings → Retry On Fail | on, 2 tries, wait 5000 ms - covers transient 5xx and network errors |

The JSON field (an expression - the `{{ }}` parts are evaluated by n8n):

```json
{
  "date": "{{ $now.setZone('Asia/Kolkata').toFormat('yyyy-MM-dd') }}",
  "tz_offset_minutes": 330,
  "lat": 19.076,
  "lng": 72.8777
}
```

Putting the key in a credential rather than a plain header field keeps it encrypted at rest and out of exported workflow JSON. `$now` is a Luxon `DateTime`; `setZone` matters because the workflow server may run in UTC, and at 05:30 IST it is still the previous day in UTC. If you already have a curl for the call, the node's **Import cURL** fills these fields from it.

## Using the output

The node returns the parsed response as the item's JSON, so the next node reads fields with expressions like `{{ $json.data.tithi.name }}`. For Mumbai on 1 December 2026 the response contained:

*Fields from `data`*

| Expression | Value |
| --- | --- |
| `$json.data.vara.name` | Mangalavara |
| `$json.data.tithi.paksha` + `$json.data.tithi.name` | Krishna Ashtami |
| `$json.data.nakshatra.name` | Magha |
| `$json.data.yoga.name` / `$json.data.karana.name` | Vaidhriti / Balava |
| `$json.data.sunrise` | `2026-12-01T01:25:17.000Z` (UTC) |

Sunrise is a UTC instant. To print it as local time in the message: `{{ DateTime.fromISO($json.data.sunrise).setZone('Asia/Kolkata').toFormat('HH:mm') }}` - 06:55 here. `$json.interpretation.summary` holds a one-line English summary if you want something ready-made.

## The mistake that bites first: numbers that arrive as strings

Quoting an expression makes its result a string. That is right for `date`, wrong for numbers: `"tz_offset_minutes": "{{ $json.offset }}"` sends `"330"`, and the same happens when coordinates come from a spreadsheet or form node that stores them as text. AstroNode does not coerce types, so the call fails:

Real response to `{"date": "2026-12-01", "tz_offset_minutes": "330", "lat": "19.076", "lng": 72.8777}`:

```json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Request validation failed",
    "details": [
      { "instancePath": "/tz_offset_minutes", "message": "Invalid input: expected number, received string" },
      { "instancePath": "/lat", "message": "Invalid input: expected number, received string" }
    ]
  }
}
```

Leave number expressions unquoted - `"lat": {{ $json.lat }}` - or convert explicitly with `{{ Number($json.lat) }}`. `details[].instancePath` names every field that failed, so read the n8n error output rather than retrying. More on this error: [VALIDATION_ERROR](https://astronode.dev/docs/errors/validation-error).

## Questions

**Which AstroNode endpoints does the n8n example call?**

1 endpoint: Panchang (`POST /v1/panchang`).

**Was the n8n code on this page actually run?**

n8n was not run. The exact request the node sends (method, URL, header, JSON body) was executed with curl against the in-memory API, as was the string-typed body that produces the 400 below.

## Endpoints

- [`POST /v1/panchang`](https://astronode.dev/capabilities/vedic/panchang) - Panchang API
