Merge contentful with openweather for location pages
Localized marketing with live weather
Contentful page body and OpenWeather current conditions in parallel. For "merge contentful with openweather for location pages", store CONTENTFUL_ACCESS_TOKEN, OPENWEATHER_API_KEY in Secret Vault, call https://cdn.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Static HTML / Jamstack hit only https://realcomposer.com/v1/workspace/merge-contentful-with-openweather-pages with an rc_live_ client token.
Waterfall latency from multiple Contentful and OpenWeather requests
Static HTML / Jamstack widgets often await Contentful and OpenWeather sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.
- Race conditions between parallel manual fetches
- Higher mobile data usage from redundant JSON
- Timeouts when any upstream exceeds cellular RTT
How RealComposer Solves This at the Edge
Store upstream credentials in Secret Vault
Create CONTENTFUL_ACCESS_TOKEN, OPENWEATHER_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.
Set headers, mapping, and cache TTL
Use GET against https://cdn.contentful.com/spaces/{{query.spaceId}}/entries. Allowed origins on the client token should match leave cache ttl at 0 when each response is user-specific (include userid or record id in query params before enabling cache).
Call from Static HTML / Jamstack
Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.
fetch('https://realcomposer.com/v1/workspace/merge-contentful-with-openweather-pages', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_merge-co",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "merge-contentful-with-openweather-pages"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"contentful_entryId": "sample",
"contentful_title": "sample",
"weather_temp": "sample",
"weather_city": "sample"
}
Recipe Specs
- HTTP method
- GET
- Upstream calls
- 2
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 4
- Payload
- 258 B to 107 B (-59%)
curl -X GET "https://realcomposer.com/v1/workspace/merge-contentful-with-openweather-pages" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
What should Static HTML / Jamstack store instead of Contentful secrets?
Log request IDs for merge-contentful-with-openweather-pages, not raw Contentful payloads, because upstream bodies may include PII.
How do I forward JSON bodies to POST upstreams?
Cache key for merge-contentful-with-openweather-pages: internal edge-cache path plus sorted query. Identical params hit; vary userId per user.
Can I restrict which domains call this pipeline?
Allowed origins on the merge-contentful-with-openweather-pages client token restrict which domains may call the edge URL.
Sources & Definitions Used in This Answer
Deploy this Static HTML / Jamstack + Contentful, OpenWeather Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.