📎 Webclip
Build A Weather by Text Service With Twilio
The page explains how to build an SMS weather service with Twilio, Stamplay, and OpenWeather. A user texts a Twilio number with a city name, Stamplay catches the message, a Code Block fetches weather data and formats the reply, and a second Task sends the SMS back.
Reading notes#
- The service starts when a user sends an SMS with a city name to a Twilio number.
- A Stamplay Task captures the SMS through the Twilio integration and sends it to a custom Code Block.
- The Code Block requests weather data from OpenWeather, builds a readable message, and returns it.
- If the text includes the word forecast after the city name, the Code Block returns a 5-day forecast instead of current weather.
- The query uses the city name as q, an OpenWeather API key as APPID, and either imperial or metric units.
- Another Stamplay Task runs after the Code Block finishes and sends the response SMS using the body and to values from the Code Block output.
- To test the service, the page says to text the Twilio number from a verified number in Twilio.
