Contact Sales

All fields are required

Build a Weather Bot with SignalWire AI Agent | SignalWire

Build a Weather Bot with SignalWire AI Agent

A deep dive into an AI weather bot configuration in JSON

FreeSWITCH Enterprise Support Lead

Len Graham

AI Weather Bot Code Deep Dive

SignalWire AI Agent for voice allows you to create and deploy intelligent, human-like digital employees. With advanced natural language processing (NLP) and customizable configurations, you can elevate customer experiences with unique virtual agents for any industry.

In this example, we’ll examine a JSON configuration structured for AI-powered interactions about the weather, with special focus on information retrieval. This configuration is rich in functionalities, including voice recording, customizable AI behavior, and specialized tasks like sending messages and fetching weather information.

This post will hone in on specific snippets of the code. You can view the full example on GitHub. Test out the weather bot for yourself by calling 1 (206) 451-CAST.

This configuration is structured under a sections key, with different operational blocks in the main array. Each block serves a unique purpose, ranging from voice recording settings to complex AI operations.


This snippet defines the AI agent’s area of expertise, personality, and outlines the steps the bot should take in the conversation. The prompt is the backbone for your unique AI agent, and helps the AI understand its mission.

Answer Block

This block answers the call.

Record Call Block

Here, the system is instructed to record calls in WAV format with stereo audio quality, essential for applications requiring audio analysis or legal compliance.

AI Configuration Block - Detailed Breakdown

Post-Prompt Configuration

These configurations define the endpoint and authentication details for the AI to communicate with after executing prompts, ensuring secure data transmission.


This enables detailed logging for debugging purposes and specifies a webhook URL for sending debug information, crucial for monitoring and troubleshooting AI operations.

Post Prompt

The post_prompt dictates the AI's task to summarize the conversation, adjusting creativity and randomness with top_p and temperature. This guides the AI in generating concise summaries of interactions.

Pronunciation Adjustments

This particular example aims to customize how the AI interprets and vocalizes "mph," ensuring clarity in pronunciation by expanding abbreviations where necessary. Pronunciation adjustments ensure clarity in vocalization, particularly useful for acronyms like “mph.”


There are several customizable functions that allow the weather bot to perform a selection of actions related to sending messages and retrieving weather information. You can view the entire code snippet for these functions in the GitHub repo.

These functions include:

Send Text Message

The send_message function allows the AI to send SMS messages to users. The user inputs for the recipient's phone number and message content. It showcases the use of SignalWire Markup Language (SWML) to structure the message sending action.

Send Multimedia Message

The send_mms function expands upon the SMS functionality to include the capability of sending multimedia content along with text messages. It demonstrates how to include media URLs in the message payload for a more engaging user experience.

Get Latitude and Longitude

The get_lat_lon function fetches geographic coordinates (latitude and longitude) for a given city or state. This function showcases the integration with external APIs (in this case, OpenStreetMap) to retrieve location data, essential for weather-related inquiries.

Get Weather Point

The get_weather_point function utilizes the geographic coordinates to fetch a specific weather forecast point from the National Weather Service. This function serves as a bridge to obtaining detailed weather forecasts by providing a URL for further querying.

Get Weather Detailed Forecast

The get_weather_detailed_forecast function directly queries a detailed forecast for a specific location using a URL obtained from the previous step (get_weather_point). It exemplifies how to navigate from obtaining latitude and longitude to fetching and presenting a detailed weather forecast to the user.

By leveraging the rich functionalities of SignalWire AI Agent, you can build custom applications like this weather bot with functions like fetching weather information based on location and sending SMS or MMS messages to users.

This is just one example of how to make use of the functionalities of an AI agent. Incorporating AI into customer-facing applications is a strategic move for businesses looking to stay competitive. With tools like SignalWire's AI Agent, the future of customer engagement is smarter, more intuitive, and more engaging than ever.

Start building today for free by signing up for a space, and bring your questions to our developer community on Slack!

Related Articles