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 allow 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 personalized campaigns to your users.
For example- A typical use-case for an E-commerce industry: There is a high likelihood of rain in the user's location. And you want to send a message to user nudging him to buy an umbrella.
Integration
library_add_check |
Prerequisites
|
Available APIs
The following are the AccuWeather APIs that 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 the 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 be using AccuWeather's location and current conditions APIs.
Here, we will make 2 API calls - The first one to get the user's location and the second one to get the current weather conditions at that location.
- Go to step 2 on campaign creation.
- 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
5. You can print the output in the template or use the Personalized Previews to preview.
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".