AccuWeather
Accuweather는 전 세계에 기상 예보 서비스를 제공하는 미디어 회사입니다. With AccuWeather, you can enrich and personalize your marketing campaigns, as well as automate translations through the use of Braze Connected Content.
This integration is maintained by AccuWeather.
필수 조건
요구 사항 | 설명 |
---|---|
Accuweather API 키 | 요청 URL에서 사용할 호환 API 키에 대해 Accuweather 계정 매니저에게 문의하세요. Further instructions can be found on the AccuWeather Enterprise API page. |
사용 가능한 Accuweather API
다음은 Braze 캠페인 및 캔버스에서 참조할 수 있는 AccuWeather API입니다.
API | 설명 |
---|---|
Locations | 원하는 위치에 대한 위치 키를 얻으십시오. 위치 키를 사용하여 예보 또는 현재 조건 API에서 날씨 데이터를 검색합니다. |
Forecast | 특정 위치에 대한 예보 정보를 얻으십시오. |
Current Conditions | 특정 위치에 대한 현재 조건 데이터를 가져옵니다. |
Indices | 특정 위치에 대한 일일 지수 값을 가져옵니다. 색인 가용성은 위치에 따라 다릅니다. |
Weather Alarms | 특정 위치에 대한 날씨 경보를 받으세요. Accuweather 날씨 경보는 위치에 대한 일일 예보를 사용하여 결정됩니다. An alarm exists for a location if the forecast weather meets or exceeds specific thresholds. |
Alerts | 공식 정부 기상청 및 주요 글로벌 기상 경보 공급자로부터 악천후 경고를 받습니다. |
Imagery | 레이더 및 위성 이미지를 얻으십시오. |
Tropical | 전 세계 열대성 저기압의 현재 위치, 과거 위치 및 예보를 확인합니다. |
Translations | 사용 가능한 언어 목록을 가져옵니다. 특정 그룹의 구문에 대한 번역을 확인합니다. |
연결된 콘텐츠 예시
다음 예제에서는 사용자의 미국 내 우편번호의 현재 조건에 따라 두 가지 다른 유형의 메시지를 표시하는 연결된 콘텐츠 호출을 보여줍니다. Accuweather 위치 및 현재 조건 API 엔드포인트가 사용됩니다.
1
2
3
4
5
6
7
8
9
10
11
{% connected_content http:///dataservice.accuweather.com/locations/v1/postalcodes/{{${country}}}/search?q={{custom_attribute.${Zip Code}}}&apikey={your API key} :save location_info %}
{% connected_content http://dataservice.accuweather.com/currentconditions/v1/{{location_info[0].Key}}?apikey={your API key} :save local_weather %}
{% if {{local_weather[0].WeatherText}} == 'Cloudy' %}
No sunscreen needed :)
{% elsif {{local_weather[0].WeatherText}} == 'Rain' %}
It's raining! Grab an umbrella!
{% else %}
Enjoy the weather!
{% endif %}
다음 예제에서 두 개의 연결된 콘텐츠 호출에 대한 분석을 확인할 수 있습니다.
위치 API 예시
첫 번째 connected_content
태그 내에서 위치 API에 대한 GET 요청이 수행됩니다. 이 예제에서는 우편번호 커스텀 속성이 없는 경우 사용자의 {{${city}}}
를 대신 활용할 수 있습니다.
1
{% connected_content http://dataservice.accuweather.com/locations/v1/postalcodes/{{${country}}}/search?q={{custom_attribute.${Zip Code}}}&apikey={your API key} :save location_info %}
다음은 Accuweather가 JSON 객체로 반환할 예입니다:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
[
{
"Version": 1,
"Key": "41333_PC",
"Type": "PostalCode",
"Rank": 35,
"LocalizedName": "Seattle",
"EnglishName": "Seattle",
"PrimaryPostalCode": "98102",
"Region": {
"ID": "NAM",
"LocalizedName": "North America",
"EnglishName": "North America"
},
"Country": {
"ID": "US",
"LocalizedName": "United States",
"EnglishName": "United States"
},
"AdministrativeArea": {
"ID": "WA",
"LocalizedName": "Washington",
"EnglishName": "Washington",
"Level": 1,
"LocalizedType": "State",
"EnglishType": "State",
"CountryID": "US"
},
"TimeZone": {
"Code": "PDT",
"Name": "America/Los_Angeles",
"GmtOffset": -7.0,
"IsDaylightSaving": true,
"NextOffsetChange": "2018-11-04T09:00:00Z"
},
"GeoPosition": {
"Latitude": 47.636,
"Longitude": -122.327,
"Elevation": {
"Metric": {
"Value": 26.0,
"Unit": "m",
"UnitType": 5
},
"Imperial": {
"Value": 85.0,
"Unit": "ft",
"UnitType": 0
}
}
},
"IsAlias": false,
"ParentCity": {
"Key": "351409",
"LocalizedName": "Seattle",
"EnglishName": "Seattle"
},
"SupplementalAdminAreas": [
{
"Level": 2,
"LocalizedName": "King",
"EnglishName": "King"
}
],
"DataSets": [
"Alerts",
"DailyAirQualityForecast",
"DailyPollenForecast",
"ForecastConfidence",
"MinuteCast"
]
}
]
‘키’ ID는 두 번째 GET 요청에서 사용되므로 유용한 변수입니다.
이 JSON 오브젝트는 URL 뒤에 :save location_info
를 지정하여 로컬 변수 location_info
에 저장할 수 있습니다.
현재 조건 API 예시
두 번째 connected_content
태그의 경우, 현재 조건 API에 대한 GET 요청이 수행됩니다. 요청 URL에 위치 키를 추가해야 합니다. 여기에 예시 connected_content
태그가 있습니다:
1
{% connected_content http://dataservice.accuweather.com/currentconditions/v1/{{location_info[0].Key}}?apikey={your API key} :save local_weather %}
다음은 반환된 JSON 객체입니다:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[
{
"LocalObservationDateTime": "2018-04-10T09:35:00-07:00",
"EpochTime": 1523378100,
"WeatherText": "Rain",
"WeatherIcon": 18,
"IsDayTime": true,
"Temperature": {
"Metric": {
"Value": 11.0,
"Unit": "C",
"UnitType": 17
},
"Imperial": {
"Value": 52.0,
"Unit": "F",
"UnitType": 18
}
},
"MobileLink": "http://m.accuweather.com/en/us/seattle-wa/98104/current-weather/41333_pc?lang=en-us",
"Link": "http://www.accuweather.com/en/us/seattle-wa/98104/current-weather/41333_pc?lang=en-us"
}
]
connected_content
태그에서 볼 수 있듯이 JSON 오브젝트는 URL 뒤에 :save local_weather
를 추가하여 로컬 변수 local_weather
에 저장됩니다.
WeatherText의 출력 결과를 {{local_weather[0].WeatherText}}
을 참조하여 테스트할 수 있습니다.
API 호출이 {{local_weather[0].WeatherText}}
로 응답하고 Rain
을 반환하면 사용자는 푸시를 받습니다