Skip to content

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.

License

Notifications You must be signed in to change notification settings

kierancanny/aws-serverless-sar-pinpoint-weather-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pinpoint Weather Bot

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

Requirements

Installation Instructions

  1. Create an AWS account if you do not already have one and login.
  2. Go to the app's page on the Serverless Application Repository and click "Deploy"
  3. Provide the required app parameters (see parameter details below) and click "Deploy"

Using this Application

  • 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.

How it works

  • 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

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published