Skip to content

MicrosoftDocs/mslearn-send-crop-weather-alerts

Repository files navigation

Code for Send Crop Weather Alerts Learn module

This is the code used in the Learn module "Send Crop Weather Alerts"

Description

This app allows subscribing to teperature alert for a given location (specified in free form text) if a defined minimum or maximum temperature are exceeded. Twilio is used to subscribe to alerts via SMS and receive alerts via SMS.

How to Deploy

  1. Create a new Python Azure Functions app

  2. In the Function app's storage account create a Table with name alerts

  3. Create an Azure Maps Account and obtain your primary API key

  4. Create a Twilio account and a SMS capable phone number. Get your Twilio AccountSID and AuthToken and the Twilio Phone Number.

  5. Create the following App Settings in the Function App

        "AZURE_MAPS_SUBSCRIPTION_KEY": "<YOUR AZURE MAPS KEY HERE>",
        "TwilioAccountSID": "<YOUR TWILIO ACCOUNTSID HERE>",
        "TwilioAuthToken": "<YOUR TWILIO ACCOUNT AUTH TOKEN HERE>",
        "TWILIO_PHONE_NUMBER": "<YOUR TWILIO PHONE NUMBER HERE, e.g. +12223334444>"
    
  6. Deploy this repo to your function app.

  7. Get the Function URL for the SetupAlert endpoint (with the Function Key included)

  8. In the Twilio console, go to the Phone Number management setting and add a webhook for SMS messages with the URL from the previous step.

Now you are ready to use the app by sending a SMS to your Twilio number!

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

About

Code repo for the Send Crop Weather Alerts learning module

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages