This application currently only works for US regions and phone numbers but I'll expand to other regions in the near future.
Pinpoint Weather Bot responds to a text message from a user with current weather conditions. Incoming text message must conform to the format "weather zipcode", else it will be ignored.
Important: this application uses Amazon Pinpoint's SMS long codes. There are costs associated with reserving a phone number and sending text messages. Please see the current Amazon Pinpoint pricing for details.
See the full walkthrough for this application at https://aws.amazon.com/blogs/compute/building-a-serverless-weather-bot-with-two-way-sms-aws-sam-and-aws-lambda.
.
├── README.MD <-- This instructions file
├── event.json <-- API Gateway Proxy Integration event payload
├── smsResponderFunction <-- Source code for a lambda function
│ └── app.js <-- Main Lambda handler
│ └── getWeather.js <-- Gets the weather from OpenWeatherMap
│ └── smsResponder.js <-- Sends the response via SMS
│ └── testHarness.js <-- For testing code locally
│ └── package.json <-- NodeJS dependencies and scripts
├── template.yaml <-- SAM template
- AWS CLI already configured with Administrator permission
- NodeJS 8.10+ installed
- Create an AWS account if you do not already have one and login.
- Go to the app's page on the Serverless Application Repository and click "Deploy"
- Provide the required app parameters (see parameter details below) and click "Deploy"
- This application requires an API Key from OpenWeatherMap.
- You also need an active Pinpoint project configured with a long code number configured for 2-way text messaging. The Pinpoint Application ID (also known as the Project ID) is needed as a parameter for this code.
- A user sends an SMS message to your Pinpoint long code, which is forwarded to an SNS topic.
- This application is invoked by the SNS topic - it parses the text message for the 'weather' keyword and a US zipcode.
- The code queries the OpenWeatherMap API for current weather conditions and responds to the originating number with a weather summary.
==============================================
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0