Send Your First Message
Make your first API call to send an SMS or WhatsApp message.
What you'll accomplish: Get API keys → Send a message → Track delivery
⏳ Time required: ~2 minutes
Prerequisites
Light onboarding path (no KYC required):
- Email and phone verified
- API key copied from dashboard
- Pre-built template ID copied from dashboard
Full production setup path:
- Account set up and KYC approved
- Channels configured
- Custom template created and approved
- API key copied from dashboard
How Message Sending Works
Get Your API Keys
From your Sent Dashboard, copy your API key:
Security reminder: Never commit API keys to version control. Use environment variables.
Send a Message
Choose your preferred method:
# Set your API key and template ID
export SENT_API_KEY="your_api_key_here"
export TEMPLATE_ID="your_template_id_here"
export RECIPIENT="+1234567890"
curl -X POST "https://api.sent.dm/v3/messages" \
-H "x-api-key: $SENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": ["'"$RECIPIENT"'"],
"template": {
"id": "'"$TEMPLATE_ID"'"
},
"channel": ["sms", "whatsapp"]
}'import SentDm from '@sentdm/sentdm';
const client = new SentDm(); // Uses SENT_DM_API_KEY env var
const response = await client.messages.send({
to: ['+1234567890'],
template: {
id: 'your_template_id_here'
},
channel: ['sms', 'whatsapp']
});
console.log('Message sent:', response.data.recipients[0].message_id);from sent_dm import SentDm
client = SentDm() # Uses SENT_DM_API_KEY env var
response = client.messages.send(
to=["+1234567890"],
template={
"id": "your_template_id_here"
},
channel=["sms", "whatsapp"]
)
print(f"Message sent: {response.data.recipients[0].message_id}")package main
import (
"context"
"fmt"
"github.com/sentdm/sent-dm-go"
"github.com/sentdm/sent-dm-go/option"
)
func main() {
client := sentdm.NewClient(
option.WithAPIKey("your_api_key_here"),
)
response, err := client.Messages.Send(context.Background(), sentdm.MessageSendParams{
To: []string{"+1234567890"},
Channel: []string{"sms", "whatsapp"},
Template: sentdm.MessageSendParamsTemplate{
ID: sentdm.String("your_template_id_here"),
},
})
if err != nil {
panic(err)
}
fmt.Println("Message sent:", response.Data.Recipients[0].MessageID)
}import dm.sent.client.SentDmClient;
import dm.sent.client.okhttp.SentDmOkHttpClient;
import dm.sent.models.messages.MessageSendParams;
SentDmClient client = SentDmOkHttpClient.fromEnv();
MessageSendParams params = MessageSendParams.builder()
.addTo("+1234567890")
.addChannel("sms")
.addChannel("whatsapp")
.template(MessageSendParams.Template.builder()
.id("your_template_id_here")
.build())
.build();
var response = client.messages().send(params);
System.out.println("Message sent: " + response.data().recipients().get(0).messageId());using Sentdm;
using Sentdm.Models.Messages;
using System.Collections.Generic;
SentDmClient client = new(); // Uses SENT_DM_API_KEY env var
MessageSendParams parameters = new()
{
To = new List<string> { "+1234567890" },
Channels = new List<string> { "sms", "whatsapp" },
Template = new MessageSendParamsTemplate
{
Id = "your_template_id_here"
}
};
var response = await client.Messages.SendAsync(parameters);
Console.WriteLine($"Message sent: {response.Data.Recipients[0].MessageId}");<?php
require_once 'vendor/autoload.php';
use SentDM\Client;
$client = new Client($_ENV['SENT_DM_API_KEY']);
$result = $client->messages->send(
to: ['+1234567890'],
template: [
'id' => 'your_template_id_here'
],
channels: ['sms', 'whatsapp']
);
echo "Message sent: " . $result->data->recipients[0]->message_id . "\n";require "sentdm"
sent_dm = Sentdm::Client.new(
api_key: ENV["SENT_DM_API_KEY"]
)
result = sent_dm.messages.send(
to: ["+1234567890"],
template: {
id: "your_template_id_here"
},
channels: ["sms", "whatsapp"]
)
puts "Message sent: #{result.data.recipients[0].message_id}"Use the Sent Dashboard Playground:
- Select your template
- Enter recipient phone number
- Choose channels (SMS/WhatsApp)
- Click "Send Message"
Understanding the Response
Success (HTTP 202):
{
"success": true,
"data": {
"status": "QUEUED",
"template_id": "7ba7b820-9dad-11d1-80b4-00c04fd430c8",
"template_name": "order_confirmation",
"recipients": [
{
"message_id": "8ba7b830-9dad-11d1-80b4-00c04fd430c8",
"to": "+14155551234",
"channel": "sms"
}
]
},
"error": null,
"meta": {
"request_id": "req_7X9zKp2jDw",
"timestamp": "2026-03-04T11:28:25.2096416+00:00",
"version": "v3"
}
}Key fields:
recipients[].message_id- Save this to track the messagerecipients[].channel- Which channel was used (automatically selected)status- Will be "accepted" on successmeta.request_id- Use this for support inquiries
Track Delivery Status
Via Dashboard
View message status in the Activities page:
Via Webhooks (Recommended)
Set up webhooks to receive real-time status updates:
{
"field": "messages",
"id": "8ba7b830-9dad-11d1-80b4-00c04fd430c8",
"status": "DELIVERED",
"channel": "sms",
"to": "+14155551234",
"from": "+1987654321",
"template_id": "7ba7b820-9dad-11d1-80b4-00c04fd430c8",
"timestamp": "2026-01-15T10:35:00+00:00",
"error": null
}Via API
Query message status:
curl "https://api.sent.dm/v3/messages/{message_id}" \
-H "x-api-key: $SENT_API_KEY"Message Status Lifecycle
queued → sent → delivered
↓ ↓ ↓
failed failed read (WhatsApp only)| Status | Description |
|---|---|
queued | Message accepted, waiting to send |
sent | Dispatched to carrier/WhatsApp |
delivered | Confirmed delivery to device |
read | Recipient opened (WhatsApp only) |
failed | Delivery failed (see error code) |
Common Parameters
Channel Selection
{
"channel": ["whatsapp", "sms"] // Auto-fallback if first fails
}| Option | Behavior |
|---|---|
["whatsapp", "sms"] | Try WhatsApp first, fallback to SMS |
["sms"] | SMS only |
["whatsapp"] | WhatsApp only |
| omitted | Automatic optimal selection |
Template Variables (Parameters)
{
"to": ["+1234567890"],
"template": {
"id": "tmpl_123",
"name": "order_confirmation",
"parameters": {
"customerName": "John Doe",
"orderNumber": "#12345"
}
}
}Sandbox Mode
Test without sending real messages by adding "sandbox": true to your request body:
{
"to": ["+1234567890"],
"template": {
"id": "tmpl_123"
},
"channel": ["sms"],
"sandbox": true
}The API will validate your request and return a realistic fake response without executing any side effects — no database writes, no messages sent, no external API calls. Look for the X-Sandbox: true header in the response.
🎉 Success!
You've sent your first message! Here's what to explore next:
Sending Messages Guide
Learn advanced messaging patterns
Set Up Webhooks
Receive delivery notifications
Install an SDK
Integrate with your application
Dashboard Features
Explore the full dashboard
Troubleshooting
401 Unauthorized (AUTH_001)?
- Check your API key is correct
- Ensure the
x-api-keyheader is set (notx-sender-id- that's v2 legacy)
403 Insufficient Balance (BUSINESS_003)?
- Add a payment method in Billing
- Check your account balance
400 Bad Request?
- Verify template ID is correct
- Check phone number format (E.164: +1234567890)
- Ensure template is approved (for WhatsApp)
Message stuck in "queued"?
- Normal for first few seconds
- Check Activities page
- Set up webhooks for real-time updates