Introduction to SWSH (SignalWire interactive shell)
Introduction to SWSH (SignalWire interactive shell)
Introduction to SWSH (SignalWire interactive shell)
SWSH (SignalWire interactive SHell) is a command line utility written in Python to interface with SignalWire APIs. SWSH is built to easily configure and manage SignalWire Spaces from a command-line environment.
SWSH is extremely useful in scripting contexts, and allows the user to perform repeated tasks quickly and efficiently by passing commands into SWSH.

Before you begin, ensure you have the following prerequisites:
SWSH can be installed in two ways.
Install SWSH standalone if you’re looking for a scriptable SignalWire CLI without the additional development and testing features provided by WireStarter.
Python3 is required for the SWSH standalone installation.
We also recommend using the python3 venv module, but it isn’t required.
This command uses the venv module to create a new Python virtual environment named “swsh”.
Before running it, navigate to the directory where you wish to store the swsh virtual environment.
This command activates the swsh virtual environment you just created.
This changes your shell’s environment to use the Python and pip binaries within this environment,
isolating your Python setup from the system-wide Python installation.
This command installs the swsh package and its dependencies inside the activated virtual environment.
We’re aware of an issue with Python 3.12 causing dependency issues. Avoid these issues by specifying version 3.11 for pip.
Now that SWSH is installed, you can start a shell with it by running:
WireStarter is a Docker container which sets up the SignalWire SDKs and builds a development and testing environment for new developers. Install SWSH with WireStarter if you want to take advantage of WireStarter’s features.
The instructions for installing WireStarter using Docker are universal and will work on MacOS, Linux, and Windows.
Docker must be running at the start of the process.
WireStarter has been updated recently. If you’ve used WireStarter before, be sure to delete the previous version and reinstall the latest version of the container.
This command starts a terminal UI which will prompt you for relevant IDs and tokens. It will walk you through configuring the development and testing environment. It then automatically enters SWSH.
Follow the prompts on screen to enter your SignalWire Space, Project ID, and API token.
Your SignalWire Space is the subdomain that prefixes signalwire.com.
If your Dashboard is accessed at https://spacename.signalwire.com/dashboard,
you should enter spacename when prompted for your Space.
Copy the Project ID and REST API token from the
API pane of your SignalWire Dashboard.
If you don’t plan to set up a WireStarter example application, you can safely ignore both ngrok prompts by leaving them blank and hitting Enter or Return.
Learn more about WireStarter by visiting its repository on GitHub.
Now that SWSH is installed, you can run it at any time by entering this command:
The Project ID, API Token, and API Key must be correctly configured in order to use SWSH commands.
The following variables can be set to streamline startup.
They are also required for running in Non-Interactive mode.
If they are not set, SWSH will ask for them at startup.
Linux / MacOS:
Windows:
This section defines all SWSH commands. Commands can be run interactively or non-interactively.
Interactive commands are done within the SWSH shell itself. For example:
swsh to enter the shellphone_number listThis type of command can be passed into SWSH, allowing for the output from SWSH to be passed back to the main shell. This type of SWSH command is ideal for scripting. Startup variables must be set in order to enable scriptable commands.
Scriptable commands use the same syntax as Interactive commands, but condensed into a single line. For example:
Manage your SignalWire Space using the following SWSH commands:
Manage the Project (and any subprojects) within a SignalWire Space using the following SWSH commands:
Domain Applications allow you to send SIP traffic to a custom domain and run specified logic. Manage Domain Applications within a SignalWire Project using the following commands:
Number Groups are useful for configuring a set (or “group”) of numbers as a single entity. Manage Number Groups within a SignalWire Project using the following commands:
Manage cXML Applications within a SignalWire Project with these commands:
Manage the SignalWire Phone Numbers within a SignalWire Project with these commands:
Manage SIP Endpoints within a SignalWire Project with these commands:
Manage SIP Profiles within a SignalWire Project with these commands:
Initiate a phone call between two parties using a SignalWire Project.
The Sending Phone Number must belong to the project.
Retrive Call Records on a SignalWire Project
Transmit a text message to a destination using a SignalWire Project.
The Sending Phone Number must belong to the project.
Clears the screen.
clear
Exit the swsh subshell.
exit
Help us improve SWSH for your use case by reporting an Issue on the SWSH GitHub Repository.