AWS Builder Center
Pehra: Hindi heat-safety plans on WhatsApp, built on AWS serverless

Pehra: Hindi heat-safety plans on WhatsApp, built on AWS serverless

India warns about heat using temperature alone, so humid heat that kills goes unwarned. Here's how we turned the free forecast into WBGT work-rest plans in Hindi on WhatsApp, with phone calls and a ₹600 IoT Site Box, using Lambda, Step Functions, Bedrock, Cedar, Polly and IoT Core.

Series: Environmental Hacks 2026 (1 article)

  1. 1
    Pehra: Hindi heat-safety plans on WhatsApp, built on AWS serverless This article
India warns its people about heat with a thermometer. But heat doesn't harm people by temperature alone. Your body cools itself by sweating, and on a humid day the sweat can't evaporate, so the cooling stops. That's why a humid 36 °C afternoon can be more dangerous for a construction worker than a dry 42 °C one.
Safety scientists have a better number for this: WBGT (Wet Bulb Globe Temperature), which combines temperature, humidity, sun and wind into one value. NIOSH, OSHA and many armies use it to decide when work must stop. India's public heat alerts still use temperature alone.
We built Pehra (पहरा, "guard") for Environmental Hacks 2026 (WeMakeDevs × AWS, Track 02: Heat & Water). It turns the free weather forecast into WBGT work-rest plans, in Hindi, on WhatsApp, with Hindi phone calls for alerts. For sites with no smartphone, there's a ₹600 Site Box on AWS IoT Core with a live 3D twin. Everything runs as one serverless stack in Mumbai, and every number comes from code, never from the AI model.

The heat nobody warned about

On 16 April 2023, people died of heatstroke at an open-air award event in Kharghar, Navi Mumbai. News reports put the reading at the nearest weather station at about 38 °C. IMD's rule says a heatwave "need not be considered till maximum temperature of a station reaches atleast 40°C for Plains" (NDMA). So there was no alert.

The science points somewhere else. A CDC study of 25 outdoor workers' heat illnesses found that WBGT-based exposure limits were exceeded in all 14 deaths, including six that happened when the Heat Index looked moderate.

We replayed Kharghar on ERA5 reanalysis from Open-Meteo. WBGT in the sun stayed above the 28.2 °C NIOSH work limit from 10:00 to 16:00 and peaked at 30.8 °C at noon. The danger was real; it was just invisible.
Then we ran the same check on 12 Indian cities from 2021 to 2025. 4,372 city-days crossed the WBGT work limit in the shade with no heatwave declared, and 2,327 of them fell outside March to June, when heatwave bulletins don't run. Every number on our website is produced by a script in the repo and shows its source and caveats.


What Pehra does, through four people

The people are illustrated; the messages below are real, from an end-to-end test on a phone on 11 October 2026.
Ramesh, site supervisor in Kharghar. He registers his site and types his crew in plain Hindi: 40 log, 10 bhaari kaam, 3 naye aaye (40 people, 10 on heavy work, 3 new). Pehra reads it back. At 7 pm he gets tomorrow's plan: stop work 9 to 5, rest every hour around it, new workers at 20%, and 7 water cans. It arrives as text and as a Hindi voice note. One tap on Approve saves it to a tamper-proof record. He can ask anything, for example kya hum kal 2 baje concrete daal sakte hain? ("can we pour concrete at 2 tomorrow?"), and the answer comes from the plan's own tools.
Gurpreet, worker. He scans the site QR code: no app, no login. He logs his rest breaks. When he feels dizzy he taps Chakkar aa raha hai ("I feel dizzy") and sees fixed first-aid steps. At that moment Ramesh gets a WhatsApp alert and his phone rings with a Hindi call.
Meena, expecting, living with her son and mother-in-law in Mumbai. She says hi, answers five button questions (counts only, never names) and gets a family plan with stricter limits for the elderly, children and pregnancy. On dangerous days, Dadi gets one Hindi phone call: stay inside 9 to 5, sip water, call 108 if unwell.
Lakshmi, fruit vendor in Delhi. She types paani Connaught Place and gets the nearest drinking water (190 m) and a water ATM (220 m), with map links from OpenStreetMap.

The ₹600 Site Box, on AWS IoT Core

Some sites have no smartphone at all. For them, Pehra is a box: an ESP32 with a DHT22 (humidity), a DS18B20 inside a matt-black globe (radiant heat), two sonar sensors (water tank and drain), an OLED with an LED risk ring, a siren, two relays (mist fan and pump) and a red SOS button. It computes site WBGT as  0.7·Tnw + 0.2·Tg + 0.1·Ta .
Each box is an IoT thing with its own X.509 certificate, and its policy lets it publish only to its own topic. A topic rule hands every reading to a Lambda function:
SQL
SELECT *, topic(3) AS box_id FROM 'pehra/box/+/telemetry'
The Lambda computes the risk level, applies the same rest bands as the WhatsApp plans, stores the state in DynamoDB and publishes a command back on  pehra/box/{thing}/cmd . A Three.js page shows the box as a live 3D twin. When the SOS button is pressed, the twin turns red, the supervisor gets a WhatsApp alert and their phone rings in Hindi.

The architecture




Everything is one AWS SAM template in ap-south-1 (Mumbai), so Indian users' data stays in India. It runs 14 Python 3.12 Lambda functions on arm64 (Graviton).
  • Amazon EventBridge Scheduler runs forecast ingest three times a day, family plans at 07:00, site plans at 19:00, re-checks at 10:30 and 13:30, and records at 23:30.
  • AWS Lambda turns the Open-Meteo forecast into WBGT once per city or 0.25° tile, not once per user, and writes it to Amazon S3. A million sites in Mumbai read the same heat file, which is why the cost stays near zero at scale.
  • Amazon API Gateway (HTTP API) receives the WhatsApp and Telegram webhooks (signature-checked, failing closed) and serves the worker page, poster, audit page and 3D twin.
  • AWS Step Functions runs one execution per site per day and waits up to 12 hours for the supervisor's tap.
  • Amazon Bedrock (Amazon Nova Pro) with Strands Agents explains plans and answers questions in Hindi.
  • Cedar makes sure the AI can never loosen a plan.
  • Amazon SQS with dead-letter queues rate-limits every outgoing message and call.
  • Amazon Polly (Kajal, Hindi) voices the notes and the calls, which Twilio places. Amazon Transcribe handles Hindi voice notes coming in.
  • Amazon DynamoDB (single table) holds sites, crews, households and boxes.
  • S3 Object Lock keeps nightly, SHA-256 hash-chained records per site.
  • AWS Systems Manager Parameter Store (SecureString) holds every secret. Amazon CloudWatch handles metrics and alarms, and Amazon SNS with AWS Budgets sends the alerts.

Pattern 1: a human approval inside a workflow

The plan has to wait for a person, possibly for hours, without a server running. Step Functions'  waitForTaskToken  does exactly that: the Lambda stores the token, WhatsApp shows Approve / Override, and the button handler calls  SendTaskSuccess .
JSON
"WaitForApproval": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke.waitForTaskToken",
"Parameters": {
"FunctionName": "${PlanStepArn}",
"Payload": { "action": "wait_token", "site_id.$": "$.result.build.site_id", "task_token.$": "$$.Task.Token" }
},
"TimeoutSeconds": 43200,
"Catch": [{ "ErrorEquals": ["States.Timeout"], "Next": "NoResponse" }],
"Next": "RecordDecision"
}

Pattern 2: the AI is not allowed to make a plan less safe

We didn't put this rule in a prompt. It's a Cedar policy, and in Cedar a  forbid  always wins over a  permit :
cedar
// The AI agent can never loosen or override a plan.
@id("agent-never-loosens")
forbid (
principal is SystemAgent,
action in [Action::"LoosenPlan", Action::"OverridePlan"],
resource
);

// Supervisors may loosen their own plan only with a written reason.
@id("supervisor-loosen-with-reason")
permit (
principal is Supervisor,
action == Action::"LoosenPlan",
resource is Plan
) when { resource.site.owner == principal && context.reason_length >= 10 };

Pattern 3: numbers come from code, never from the model

  • All numbers are computed in pure Python. Stop times, rest minutes and water cans all come from  heatcore/ , which has no AWS imports and is covered by tests.
  • The AI only explains them. Bedrock calls tools that return those numbers.
  • A number check guards every reply. Each number in the reply, units included, must appear in a tool output from the same turn. If one doesn't, the reply is regenerated once, then replaced with a fixed Hindi template.
  • First aid is fixed text. It is routed before any model call.
  • There is always a fallback. With no Bedrock, users get the fixed text; with no Polly, they get text only.
On our 40-question Hindi/English test set: facts correct 38/40, invented numbers shipped 0, correct refusals 9/9.

Proof from the account

These are real CLI outputs, rendered with  freeze  (account ID masked).





Results

Check
Result
WBGT vs the OSHA online calculator (15 Chennai hours)
mean difference 0.21 °C
NIOSH limits at 300 W
REL 28.2 °C, RAL 25.0 °C (matches the worked example)
Cedar decisions
all 12 cases pass; the AI is denied LoosenPlan and OverridePlan
AI test set (40 questions, Nova Pro)
38/40 correct, 0 invented numbers
Tests
246 passing (science, Cedar, agent tools, webhooks, Site Box, end to end)
Real phone, end to end
site, crew, plan, voice note, Approve, worker QR, dizzy alert, Hindi calls, family mode, water finder, IoT Core, live twin, SOS

What we learned

  1. Compute once, share everywhere. Keying WBGT by city or tile instead of by user turned an expensive per-person job into a few Lambda runs a day.
  1. Put safety rules in policy, not prompts. Cedar gave us one place to say "the AI can never loosen a plan", and tests that prove it.
  1. Meet people where they already are. WhatsApp, Hindi voice notes and phone calls reach workers that an app never would. A QR code replaces the app entirely.
  1. Be honest about limits. The weather grid is 11 to 25 km wide, tin roofs make real sites hotter, and there's no open Indian heat-illness outcome data. So we make no claim of lives saved: Pehra is designed to reduce exposure, and it isn't medical advice or an official warning.

Try it

Next: WhatsApp scheduled templates, an Indian caller ID, Tamil, Bengali and Odia voices, ECMWF ensembles for probabilities, and pilots with workers' groups.
Team Mavricks: Arpit Singh, Pradyuman Sharma. Built for Environmental Hacks 2026 (Bharat Builds Tour), WeMakeDevs × AWS. Data: Open-Meteo (CC BY 4.0), ERA5, OpenStreetMap (ODbL), NIOSH 2016 criteria.

Series: Environmental Hacks 2026 (1 article)

  1. 1
    Pehra: Hindi heat-safety plans on WhatsApp, built on AWS serverless This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article