AccuWeather

Introduction

AccuWeather is a media company that provides weather forecasting services worldwide. AccuWeather Enterprise Solutions include the most accurate, site-specific, customized severe weather warnings, short- and long-range forecasts, and applied weather information.

MoEngage <> AccuWeather 

MoEngage <> AccuWeather integrations allows you to enrich and personalize your marketing campaigns, as well as automate translations. You can directly fetch the user location and weather updates on the fly and send personalised campaigns to your users.

For example- A typical use-case for an E-commerce industry: There is a high likelihood of raining in the user's location. And you want to send a message to user nudging him to buy an umbrella. Screenshot_2022-06-23_at_11.33.02_PM.png

Integration

 

PREREQUISITES

  • Ensure you have an AccuWeather account.
  • Ensure you have access to your AccuWeather API keys. Contact your AccuWeather account manager for compatible API keys. Read more on AccuWeather API here

Available APIs

The following are the AccuWeather APIs can be used within your MoEngage campaigns:

API DESCRIPTION
Locations  Get a location key for your desired location. Use the location key to retrieve weather data from the Forecast or Current Conditions API.
Forecast  Get forecast information for a specific location.
Current Conditions  Get Current Conditions data for a specific location.
Indices  Get daily index values for a specific location. Index availability varies by location.
Weather Alarms  Get Weather Alarms for a specific location. AccuWeather Weather Alarms are determined using the daily forecasts for a location. An alarm exists for a location if the forecast weather meets or exceeds specific thresholds .
Alerts  Get severe weather alerts from official Government Meteorological Agencies and leading global weather alert providers.
Imagery  Get radar and satellite images.
Tropical  Get current position, past positions, and forecasts for tropical cyclones worldwide.
Translations  Get a list of available languages. Get translations for specific groups of phrases.

Steps 

The following example shows three different types of messages based on the current weather conditions at a user’s zip code. We will using AccuWeather's location and current conditions APIs.

Here, we will be making 2 API calls - First one to get the user's location and the second one to get the current weather conditions at that location. 

  1. Go to step 2 on campaign creation
  2. Hit AccuWeather's Location API and store the location details in a new variable called location_info. The “Key” is a useful variable as it is used in the next request. Read about the API response here 
{% set location_info = "https://api.accuweather.com/locations/v1/postalcodes/" + {{UserAttribute['zipcode']}} + "/search?q=" + {{UserAttribute['zipcode']}} + "&apikey=" + <your AccuWeather app key here> %}

         Note- You can alternatively leverage the user’s city if you do not have a zipcode user attribute.

     3. Hit AccuWeather's Current Condition API using location info and store the details in a new variable called local_weather. Read about the API response here 

{% set local_weather = "https://api.accuweather.com/currentconditions/v1/" + location_info[0].key + "?apikey=" + <your AccuWeather app key here> %}

     4. Now, you can define the content of your campaign based on the local weather. For example: 

If local weather is Sunny => Get a sunscreen 

If local weather is Rain => Get an umbrella 

Screenshot_2022-06-24_at_12.07.59_AM.png

     5. You can print the output in the template or use the Personalized Previews to preview. 
Screenshot_2022-06-24_at_12.12.48_AM.png


If the API call responds with {{local_weather[0].WeatherText}} returning Rain, the user would then receive the push message - "Its raining. Get an umbrella".

Was this article helpful?
0 out of 0 found this helpful