# Sending an SMS
curl "https://$SPACE.signalwire.com/api/laml/2010-04-01/Accounts/$PROJECT_ID/Messages" \
-X POST \
-u "$PROJECT_ID:$API_TOKEN" \
--data-urlencode "From=+15559825061" \
--data-urlencode "To=+15559446570" \
--data-urlencode 'Body=Hello'
import { RestClient } from "@signalwire/compatibility-api";
const client = RestClient(
PROJECT_ID,
API_TOKEN,
{ signalwireSpaceUrl: SPACE_URL }
);
// Sending an SMS
client.messages
.create({ from: "+15559825061", to: "+15559446570", body: "Hello" })
.then((message) => console.log(message.sid))
.done();
from signalwire.rest import Client as signalwire_client
client = signalwire_client(PROJECT_ID, API_TOKEN, signalwire_space_url = SPACE_URL)
message = client.messages.create(
from_="+15559825061",
to="+15559446570",
body='Hello'
)
print(message.sid)
<?php
use SignalWire\Rest\Client;
$client = new Client($PROJECT_ID, $API_TOKEN, array("signalwireSpaceUrl" => $SPACE_URL));
$message = $client->messages
->create("+15559446570", array(
"from" => "+15559825061",
"body" => "Hello"
));
print($message->sid);
Learn how to get started with tailored guides and examples.
Go straight to the technical reference you are looking for.
Ease the transition from other providers using a familiar and compatible interface. Use the REST interface for handling phone numbers, messages, faxes, recordings, and more. Or, use the XML interface for programming how your phone numbers should answer phone calls or messages.
curl --request GET \
--url https://example.signalwire.com/api/laml/2010-04-01/Accounts/{id}/Calls \
--header 'Accept: application/json' \
--header 'Authorization: Basic dGVzdDp0ZXN0'
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Welcome to SignalWire!</Say>
</Response>
Use our SignalWire REST APIs to create, list, update, or delete your SignalWire Resources (video rooms, phone numbers, access tokens, etc).
curl --request GET \
--url https://example.signalwire.com/api/video/rooms \
--header 'Accept: application/json' \
--header 'Authorization: Basic ZGVtbzpkZW1v'
const fetch = require('node-fetch'); // npm install node-fetch --save
const url = 'https://example.signalwire.com/api/video/rooms';
const options = {
method: 'GET',
headers: {Accept: 'application/json', Authorization: 'Basic ZGVtbzpkZW1v'}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
The RELAY Browser SDK transforms your standard browser into a realtime media engine, enabling developers to directly make audio and video calls to other browsers.
const roomSession = new SignalWire.Video.RoomSession({
token: '<YourJWT>',
rootElement: document.getElementById('myRoot') // an html element to display the video
})
try {
await roomSession.join();
} catch (error) {
console.error('Error', error)
}
const roomSession = new SignalWire.Video.RoomSession({
token: '<YourJWT>',
rootElement: document.getElementById('myRoot') // an html element to display the video
})
roomSession.join().then(() => {
// Use roomSession ...
}).catch(error => {
console.error('Error', error)
})
Use the RELAY Realtime SDK to receive events from resources (phone calls, video rooms, chat channels) and control them server-side (mute users, start recordings, change layouts, transfer calls, etc).
import { Video } from '@signalwire/realtime-api'
const video = new Video.Client({
project: '<project-id>',
token: '<project-token>'
})
video.on('room.started', (roomSession) => {
console.log("Room started")
roomSession.on('member.joined', (member) => {
console.log(member)
})
});
You can use our RELAY technology from a large number of SDKs, each for a different programming language. Not using JavaScript? Explore our SDKs for .NET, Go, Ruby, Python, PHP, and other languages.
using SignalWire.Relay;
using SignalWire.Relay.Calling;
using System;
using System.Collections.Generic;
namespace Example
{
class ExampleConsumer : Consumer
{
protected override void Setup()
{
Project = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
Token = "PTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
Contexts = new List<string> { "test" };
}
protected override void OnIncomingCall(Call call)
{
AnswerResult resultAnswer = call.Answer();
if (!resultAnswer.Successful) return;
call.PlayTTS("Welcome to SignalWire!");
call.Hangup();
}
}
class Program
{
public static void Main()
{
new ExampleConsumer().Run();
}
}
}
require "signalwire"
class MyConsumer < Signalwire::Relay::Consumer
contexts ['incoming']
def on_incoming_call(call)
call.answer
call.play_tts 'the quick brown fox jumps over the lazy dog'
call.hangup
end
end
MyConsumer.new.run
from signalwire.relay.consumer import Consumer
class CustomConsumer(Consumer):
def setup(self):
self.project = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
self.token = 'PTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
self.contexts = ['home', 'office']
async def ready(self):
# Consumer is successfully connected with Relay.
# You can make calls or send messages here..
async def on_incoming_call(self, call):
result = await call.answer()
if result.successful:
print('Call answered..')
# Run your consumer..
consumer = CustomConsumer()
consumer.run()
<?php
require dirname(__FILE__) . '/vendor/autoload.php';
use Generator as Coroutine;
use SignalWire\Relay\Consumer;
class CustomConsumer extends Consumer {
public $project = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
public $token = 'PTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
public $contexts = ['home', 'office'];
public function ready(): Coroutine {
yield;
// Consumer is successfully connected with Relay.
// You can make calls or send messages here..
}
public function onIncomingCall($call): Coroutine {
$result = yield $call->answer();
if ($result->isSuccessful()) {
yield $call->playTTS(['text' => 'Welcome to SignalWire!']);
}
}
}
$consumer = new CustomConsumer();
$consumer->run();
Learn about the tools built to streamline the developer experience of building with SignalWire tools.