Sending SMS
Learn how to send individual SMS messages using the textbee.dev API with code examples in multiple programming languages.
Send SMS messages using the textbee.dev API from any application that can make HTTP requests.
Prerequisites
Before you begin, make sure you have:
- β A textbee.dev account
- β A registered Android device
- β Your Device ID (found in your dashboard)
- β An API key (generate one from your dashboard)
API Endpoint
POST https://api.textbee.dev/api/v1/gateway/devices/{DEVICE_ID}/send-sms
Replace {DEVICE_ID} with your actual device ID from the dashboard.
Authentication
Include your API key in the request headers:
x-api-key: YOUR_API_KEY
Request Body
Send a JSON payload with the following structure:
{
"recipients": ["+1234567890"],
"message": "Hello, this is a test message!"
}
Parameters
- recipients (array, required): Array of phone numbers in E.164 format (e.g.,
+1234567890) - message (string, required): The SMS message text
Optional fields
- simSubscriptionId (number): Which SIM to use on multiβSIM phones
Code Examples
JavaScript/Node.js
const axios = require('axios');
const BASE_URL = 'https://api.textbee.dev/api/v1';
const DEVICE_ID = 'YOUR_DEVICE_ID';
const API_KEY = 'YOUR_API_KEY';
async function sendSMS(recipient, message) {
const response = await axios.post(
`${BASE_URL}/gateway/devices/${DEVICE_ID}/send-sms`,
{
recipients: [recipient],
message,
// simSubscriptionId: 1,
},
{
headers: {
'Content-Type': 'application/json',
'x-api-key': API_KEY,
},
}
);
return response.data;
}
// Usage
sendSMS('+1234567890', 'Hello from textbee.dev!');
cURL
curl -X POST \
https://api.textbee.dev/api/v1/gateway/devices/YOUR_DEVICE_ID/send-sms \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_API_KEY' \
-d '{
"recipients": ["+1234567890"],
"message": "Hello from textbee.dev!"
}'
Phone Number Format
Always use the E.164 format for phone numbers:
- β
Correct:
+1234567890,+441234567890 - β Incorrect:
1234567890,(123) 456-7890,123-456-7890
Next Steps
- Send bulk SMS - Send to multiple recipients
- Receive SMS - Handle incoming messages
- Set up webhooks - Get real-time notifications
Need help? Check our FAQ or contact support.