Level up your call center.
Presented by Patrick Labbett for NAEO
Follow the presentation live!
Get real-time weather data directly from the National Weather Service API and integrate temperature checks into Intelligent Series scripting.
We will also showcase using MergeComm to keep weather updated in the background.
- Pricing and usage information
- API Authentication method
- API request format and parameters
- API response format for parsing
- Usage Examples
Analyze and plan, then implement.
Pricing & Usage
"All of the information presented via the API is intended to be open data, free to use for any purpose."
"As a public service of the United States Government, we do not charge any fees for the usage of this service, although there are reasonable rate limits in place to prevent abuse and help ensure that everyone has access."
"The rate limit is not public information, but allows a generous amount for typical use. If the rate limit is exceed a request will return with an error, and may be retried after the limit clears (typically within 5 seconds). Proxies are more likely to reach the limit, whereas requests directly from clients are not likely."
Getting an API key?
"A User Agent is required to identify your application. This string can be anything, and the more unique to your application the less likely it will be affected by a security event. If you include contact information (website or email), we can contact you if your string is associated to a security event. This will be replaced with an API key in the future."
More from MDN:
HTTP headers use a key:value format.
What are headers?
- Send HTTP User-Agent header
- The value should include contact info
Are HTTP header key names case-sensitive?
Format and Parameters
- User-Agent HTTP header
- HTTP method (GET, POST, etc.)
- API endpoints
- Parameters for endpoints
Handling returned data
The response from
the API will be JSON.
We can use the Intelligent Series ParseJSON scripting element along with JSONPATH syntax to pull information from the API response.
Sample API calls and flow
- API specification from weather.gov
- Unofficial Postman Collection
- OpenAPI / Swagger format
- Github pages documentation
Plan of Attack
We have a basic understanding of the API usage, but we need to link the pieces together.
Latest Observation Data
If we know the station identifier, we can get the latest data from this endpoint:
If we know the lat/long, we can pull general
details for the location from the API.
Get a list of observation stations for the points
Get latest observations
We're back where we started: we know the observation station identifier
- Manually lookup station to reduce amount of API calls/complexity/scripting
- Follow API references to dynamically pull station for the points
Observation data can be null
MergeComm can be used as a simple caching method for saving shared data (like weather) without having to make every request on-demand. A busy client could result in API rate limits and other failures.
A well known method of improving user experience on web and software applications is to put potentially long running tasks into a background process (or thread) so a slow email server or API request does not manifest as lag for your agents.
Serendipitous MergeComm Benefits
How can we use MergeComm?
- Setup an IS Schedule to run MergeComm job
- Pull the data from the API during each run
- Update an IS Shared Field or database entry
- Refer to the IS Shared Field/database entry in script
- Avoid rate limits from activity
- Reduce API calls required during agent work time
- Keep our scripting simple (less API code)
Some of the benefits...
Example Script Review
- Example 1 - Get weather by Observation Station
- Example 2 - Get weather by lat/long
- Example 3 - Enforce temperature in scripting
- Example 4 - Get weather by address
- Example 5 - Using MergeComm
The example script is available on learn.calltheory.com - sign up for a free account for your team.
(Or email email@example.com to request a copy)
By NotifUs, LLC