Certain dynamic information like the weather may be difficult or impossible to hard-code in AIML in advance. Enter bot modules, a handy solution for interfacing with third-party APIs, external knowledge or back-end databases, and more.

The OpenWeather Bot is a utility bot module that allows you to access current weather information through their Weather API. To request alpha access, email info at pandorabots dot com and include your AIaaS account name and application ID.

Before getting started, familiarize yourself with the <sraix> element, and sign up for your own free (or paid) plan at

Note: when using utility bot modules to access third party APIs, in addition to needing an account with that service provider you should familiarize yourself with any rate or other limitations. Some third-party services may cause additional latency in bot responses.

Initial Setup in your Bot Properties

When first creating your bot, a default bot properties file is automatically created. We recommend adding three bot properties to this file to keep track of your specific values needed to make use of the module:

  • Utility bot identifier - utility/openweather
  • OpenWeather API Key - you must sign up for a weather API key at
  • Units format - the OpenWeather utility bot supports units format: imperial (i.e. Fahrenheit, feet, etc), metric (Celsius, meters) or kelvin.

For example, try adding the following parameters to your bot properties file:


NOTE: Replace {appid} with your weather API key received from

Utility Bot Usage

CURRENT {query} {location} OWMAPPID {appid} UNITSFORMAT {metric, kelvin, or imperial}

Example Canonical Category

If you added your module parameters into your bot properties files:

  <pattern>XOPENWEATHER *</pattern>
  <template><sraix><bot><bot name="myweatherutilitybot"/></bot>CURRENT <star/> OWMAPPID <bot name="myweatherapikey" /> UNITSFORMAT <bot name="myunitsformat" /></sraix></template>

Alternatively you can include the values directly into your category such as:

   <pattern>XOPENWEATHER *</pattern>
   <template><sraix bot="utility/openweather">CURRENT <star/> OWMAPPID {appid} UNITSFORMAT imperial</sraix></template>


Query DescriptionQuery Syntax
general weather condition (icon)WEATHER {location}
temperature (F, default or C, or Kelvin)TEMP {location}
cloudinessCLOUDS {location}
time of sunrise (UTC)SUNRISE {location}
time of sunset (UTC)SUNSET {location}
wind direction (cardinal)WINDDIR {location}
wind speedWINDSPEED {location}
atmospheric pressure (hPa)PRESSURE {location}
humidity (%)HUMIDITY {location}
visibility (feet, default or metric: meters)VISIBILITY {location}

Interaction Examples

Input: xopenweather weather mumbai
Output: Sky is Clear

Input: xopenweather temp beijing
Output: 39.18

Output: SE

Input: XOPENWEATHER Humidity Miami FL
Output: 65


Alternate Responses:

Open Weather utility bot may respond in unexpected ways, such as:

  • Invalid query: blank response
  • Invalid units format: response returned in imperial format
  • Ambiguous location: Multiple Candidates. Please provide more information to narrow down For example, San Diego will return this response, so you would need to include more information, e.g. San Diego, TX or San Diego CA
  • No information available for that query: nil
  • Missing / invalid utility bot: SRAIXFAILED Please check to make sure you are providing the correct utility module bot name in your sraix category.

Example Reductions:

You can reduce a natural language query to a open weather utility bot query. For example, using <srai> to your canonical category:

  <pattern>WHAT IS THE CURRENT WEATHER IN *</pattern>
  <template><srai>XOPENWEATHER WEATHER <star /></srai></template>

or if you want to return a different response:

  <pattern>WHAT IS IT LIKE IN *</pattern>
  <template><srai>XOPENWEATHER CLOUDS <star/></srai></template>

or if you want to make a change to units format for a single query:

  <pattern>WHAT IS THE METRIC TEMP IN *</pattern>
    <sraix><bot><bot name="myweatherutilitybot"/></bot>
		CURRENT TEMP <star/> OWMAPPID <bot name="myweatherapikey" /> UNITSFORMAT metric
Interaction Examples:

NOTE: these examples below assumes you have standard normal.substitution file that processes contractions like “what’s”

Input: What’s the current weather in Boston?
Output: Multiple Candidates. Please provide more information to narrow down

Input: What’s the current weather in Boston, MA
Output: scattered clouds

Input: What’s it like in Tokyo?
Output: clear sky

Input: What’s the metric temp in Beijing?
Output: 3.99