Skip to main content

Messaging

Access the Messaging API. You can instantiate a Messaging.Client to send or receive SMS and MMS. Please check Messaging Events for the full list of events that a Messaging.Client can subscribe to.

Example

The following example listens for incoming SMS messages over an "office" context, and also sends an SMS.

import { Messaging } from "@signalwire/realtime-api";

const client = new Messaging.Client({
project: "<project-id>",
token: "<api-token>",
contexts: ["office"],
});

client.on("message.received", (message) => {
console.log("message.received", message);
});

await client.send({
from: "+1xxx",
to: "+1yyy",
body: "Hello World!",
});

Classes