DEV Community

Cover image for How to Send SMS and WhatsApp Messages Faster using Sent.dm API ?
Wanda
Wanda

Posted on • Originally published at apidog.com

How to Send SMS and WhatsApp Messages Faster using Sent.dm API ?

TL;DR / Quick Answer

The Sent.dm API provides a unified integration point for business messaging across SMS and WhatsApp. Pairing Sent with Apidog lets you store credentials in environments, test API requests efficiently, validate webhook payloads, and document your entire messaging workflow—all in one place.

Try Apidog today

Introduction

API integration for messaging platforms often stalls due to operational overhead: managing API keys, sender identities, template IDs, webhook security, and channel-specific rules. Testing can be risky without a controlled workflow.

Sent.dm addresses these pain points by offering a unified API for SMS and WhatsApp, handling routing and delivery logic behind a single interface. According to Sent's public docs (as of March 26, 2026), the platform supports account verification, channel setup, template-based sending, contacts, webhook events, and a dashboard playground for testing.

đź’ˇ Tip: To streamline Sent.dm setup and testing, use Apidog. You can import Sent's OpenAPI spec, create reusable environments for your x-api-key and x-sender-id, build test scenarios, validate webhook payloads, and share collections with your team.

What the Sent.dm API Solves

Sent.dm is for teams needing to reach users via multiple messaging channels—without juggling multiple provider integrations. Instead of wiring up separate SMS APIs, WhatsApp onboarding, and custom channel logic, Sent consolidates this into one platform.

Sent.dm Messaging Architecture

Per the official docs:

  • One API base URL for all messaging workflows
  • Header-based authentication (x-api-key)
  • Sender identity model (x-sender-id)
  • Template-driven outbound messaging
  • Contacts and audience management
  • Webhooks for delivery and template events
  • Platform-level routing and failover

This solves key challenges for messaging systems:

  • Consistent payload structures
  • Reusable templates
  • Event tracking (delivered, failed, queued)
  • Secure testing workflows
  • Usable internal documentation

Typical message flow:

Application -> Message API -> Channel Rules -> Delivery Events -> Retry / Status Logic
Enter fullscreen mode Exit fullscreen mode

If each step lives in a separate tool, debugging is slow. Modeling the full flow in a platform like Apidog reduces friction from day one.

How the Sent.dm API Works

Sent acts as an intelligent middleware layer: you send one API request, and Sent routes it based on logic, recipient context, and channel availability.

Key setup steps and credential handling:

1. Account and Compliance Setup

Begin with account creation, KYC, and business setup—mandatory for compliance and sender reputation. Sent requires verification as part of onboarding.

2. Channel Setup

Configure your channels by selecting a phone number and connecting WhatsApp Business. Using the same number for SMS and WhatsApp is recommended for brand consistency.

3. Templates

Templates are required before sending messages. Create at least one template before your first API call—template-based messaging is standard, not optional.

4. API Credentials

You'll need two headers:

x-sender-id: YOUR_SENDER_ID
x-api-key: YOUR_API_KEY
Enter fullscreen mode Exit fullscreen mode

x-api-key is required for authentication. Check your Sent dashboard for exact requirements and endpoint versions (v2 vs. v3).

5. Message Request

Send a request to:

POST https://api.sent.dm/v2/messages/phone
Enter fullscreen mode Exit fullscreen mode

Example JSON payload:

{
  "phoneNumber": "RECIPIENT_PHONE_NUMBER",
  "templateId": "TEMPLATE_ID"
}
Enter fullscreen mode Exit fullscreen mode

Focus on getting template-based sends working first, then expand as needed.

Send Your First Sent.dm API Request

Set up requests so they're easy to test, maintain, and share.

cURL Example

curl -X POST "https://api.sent.dm/v2/messages/phone" \
 -H "x-sender-id: YOUR_SENDER_ID" \
 -H "x-api-key: YOUR_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{
   "phoneNumber": "RECIPIENT_PHONE_NUMBER",
   "templateId": "TEMPLATE_ID"
 }'
Enter fullscreen mode Exit fullscreen mode

JavaScript Example

const response = await fetch("https://api.sent.dm/v2/messages/phone", {
  method: "POST",
  headers: {
    "x-sender-id": process.env.SENT_SENDER_ID,
    "x-api-key": process.env.SENT_API_KEY,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    phoneNumber: process.env.TEST_PHONE_NUMBER,
    templateId: process.env.SENT_TEMPLATE_ID
  })
});

if (!response.ok) {
  throw new Error(`Sent request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);
Enter fullscreen mode Exit fullscreen mode

Python Example

import os
import requests

response = requests.post(
    "https://api.sent.dm/v2/messages/phone",
    headers={
        "x-sender-id": os.environ["SENT_SENDER_ID"],
        "x-api-key": os.environ["SENT_API_KEY"],
        "Content-Type": "application/json",
    },
    json={
        "phoneNumber": os.environ["TEST_PHONE_NUMBER"],
        "templateId": os.environ["SENT_TEMPLATE_ID"],
    },
    timeout=30,
)

response.raise_for_status()
print(response.json())
Enter fullscreen mode Exit fullscreen mode

A successful response returns HTTP 200 and a messageId. Capture this value for use in Apidog test assertions, logs, and webhook handling.

Test the Sent.dm API in Apidog

Apidog streamlines API workflows: request building, variables, assertions, documentation, and sharing—everything in one place.

Apidog Environment Example

Step 1: Create a Sent Environment

Define an environment in Apidog with variables:

base_url = https://api.sent.dm
sender_id = YOUR_SENDER_ID
api_key = YOUR_API_KEY
template_id = YOUR_TEMPLATE_ID
test_phone = RECIPIENT_PHONE_NUMBER
Enter fullscreen mode Exit fullscreen mode

Benefits:

  1. No hardcoded secrets in examples
  2. Fast switching between sandbox/staging/live accounts
  3. Teammates can use the collection with their own values

Step 2: Build the Request Once

Create a request in Apidog:

  • Method: POST
  • URL: {{base_url}}/v2/messages/phone
  • Headers:
    • x-sender-id: {{sender_id}}
    • x-api-key: {{api_key}}
    • Content-Type: application/json
  • Body:
{
  "phoneNumber": "{{test_phone}}",
  "templateId": "{{template_id}}"
}
Enter fullscreen mode Exit fullscreen mode

This makes payloads, authentication, and expected responses visible to your team.

Step 3: Add Assertions

Add tests in Apidog to validate the response:

pm.test("Status is 200", function () {
  pm.response.to.have.status(200);
});

pm.test("Response contains a messageId", function () {
  const json = pm.response.json();
  pm.expect(json.messageId).to.exist;
});
Enter fullscreen mode Exit fullscreen mode

These checks help you catch errors from API changes, credential issues, or template problems immediately.

Step 4: Turn It Into a Scenario

Expand from a single request to a workflow:

  1. Send a message
  2. Store the returned messageId
  3. Query message status (if supported)
  4. Compare webhook events

This covers the full message lifecycle, not just initial send.

Step 5: Add Webhook Examples

Add webhook event examples to your Apidog collection. Save sample payloads like:

{
  "field": "message.status",
  "messageId": "msg_123",
  "status": "delivered",
  "channel": "whatsapp"
}
Enter fullscreen mode Exit fullscreen mode

This helps backend, QA, and support teams validate event handling logic.

Step 6: Publish Internal Docs

Leverage Apidog's documentation features to create references for:

  • Required headers
  • Example payloads
  • Error responses
  • Webhook examples
  • Environment notes

This is much stronger than sharing random cURL snippets.

Handle Templates, Contacts, and Webhooks the Right Way

Getting a 200 response is only the beginning. Production readiness requires more.

Templates

Treat templates as versioned content:

  1. Store template IDs in environment/config variables
  2. Label by purpose, locale, approval status
  3. Separate test and live templates
  4. Document mappings to user journeys

Apidog lets you create and document example requests for each template.

Contacts

Contacts are a first-class feature in Sent. Even if you have user data elsewhere, document:

  • Source of truth system
  • Phone normalization logic
  • Consent/opt-in states
  • Channel switching logic

These details impact deliverability and compliance.

Webhooks

Sent webhooks use HMAC-SHA256 signatures. Verify using:

  • x-webhook-signature
  • x-webhook-id
  • x-webhook-timestamp

Signature format: v1,{base64_signature} with five-minute replay protection.

Checklist:

  1. Read raw request body
  2. Verify signature before parsing
  3. Reject stale timestamps
  4. Process events idempotently
  5. Respond fast, offload heavy processing

Express Example:

import crypto from "crypto";
import express from "express";

const app = express();

app.post("/webhooks/sent", express.raw({ type: "*/*" }), (req, res) => {
  const signature = req.header("x-webhook-signature");
  const webhookId = req.header("x-webhook-id");
  const timestamp = req.header("x-webhook-timestamp");
  const secret = process.env.SENT_WEBHOOK_SECRET;
  const rawBody = req.body.toString("utf8");

  const signedContent = `${webhookId}.${timestamp}.${rawBody}`;
  const expected = crypto
    .createHmac("sha256", Buffer.from(secret.replace(/^whsec_/, ""), "base64"))
    .update(signedContent)
    .digest("base64");

  if (signature !== `v1,${expected}`) {
    return res.status(401).send("Unauthorized");
  }

  const event = JSON.parse(rawBody);
  console.log("Received webhook event:", event.field);

  return res.sendStatus(200);
});
Enter fullscreen mode Exit fullscreen mode

Store webhook samples and document expected events in Apidog for full-team visibility.

Why Apidog Fits This Workflow

Sent.dm handles messaging delivery. Apidog handles API design, testing, documentation, and collaboration.

Task Sent.dm Apidog (for Sent API)
Send SMS and WhatsApp messages Yes No (but tests API that does)
Manage templates and sender setup Yes Documents/validates related requests
Test authenticated requests Playground only Full request builder, environments
Share API docs Platform docs Team collections, generated docs
Debug request/response Partial Full inspection, collaboration
End-to-end test scenarios Messaging flows Full API workflow testing

For teams onboarding multiple devs, enabling QA, or testing webhooks, pairing Sent with Apidog streamlines the entire workflow.

Advanced Tips and Common Mistakes

Best Practices

  1. Keep credentials server-side—never expose API keys in client code.
  2. Track messageId in logs and support tools.
  3. Separate staging and production templates.
  4. Always verify webhooks before processing.
  5. Use Apidog environments to separate live and test credentials.

Common Mistakes

  1. Treating a 200 response as final delivery (it's just the start).
  2. Hardcoding template IDs in multiple places.
  3. Ignoring sender identity setup until late.
  4. Not normalizing phone numbers.
  5. Testing with real credentials in scripts that aren't shareable.

Troubleshooting Checklist

If a request fails, check:

  1. Is x-api-key valid/active?
  2. Does the endpoint match the version in your Sent workspace?
  3. Is x-sender-id required for this endpoint?
  4. Is the template approved/available for the channel?
  5. Is the phone number in the correct format?

With Apidog, you can instantly compare failing requests to known-good saved examples.

Sent.dm Alternatives and Comparisons

If you're evaluating Sent.dm, you may also consider direct-provider APIs, broader communications platforms, or Postman for testing.

Option Strength Tradeoff
Direct SMS + WhatsApp providers Fine-grained control More integration/maintenance
Twilio-style communications stack Broad ecosystem More moving parts for multi-channel
Sent.dm Unified messaging workflow Dependent on Sent's conventions/docs
Sent.dm + Postman Familiar request testing Less workflow/documentation collaboration
Sent.dm + Apidog Unified messaging + strong API workflow Two tools instead of one

The best approach is often combining a delivery platform (Sent) with a strong API collaboration tool (Apidog). Apidog's value is in environments, docs, assertions, mock planning, and team handoff—not just sending requests.

Conclusion

Sent.dm provides a unified API for SMS and WhatsApp messaging. The real productivity boost comes from pairing it with Apidog to manage requests, assertions, webhook payloads, and documentation in one place.

Start by building your first Sent request in Apidog, add response assertions, and document your webhook contract. This approach creates a maintainable API workflow from prototype to production—no more scattered scripts or tribal knowledge.

FAQ

What is the Sent.dm API used for?

The Sent.dm API enables business messaging across SMS and WhatsApp from a single integration. It supports sender setup, templates, contacts, and webhook event handling.

Does Sent.dm support WhatsApp and SMS in one API?

Yes. Sent.dm abstracts channel-specific complexity, allowing unified messaging. The docs recommend using the same phone number for SMS and WhatsApp.

Which headers do I need for Sent.dm API requests?

x-api-key is required for authentication. Most endpoints also require x-sender-id. Verify header requirements and endpoint versions in your Sent dashboard.

Do I need templates before sending messages with Sent.dm?

Yes. The onboarding flow requires you to create a template and use its templateId in your first message request.

How do I test the Sent.dm API without writing custom scripts?

Use Apidog. Store Sent credentials in environments, save requests, add assertions, chain workflows, document webhooks, and publish docs for your team.

How should I secure Sent.dm webhooks?

Verify the HMAC signature, check the timestamp, and process events idempotently. Use headers x-webhook-signature, x-webhook-id, and x-webhook-timestamp for verification.

Is Sent.dm enough on its own for team API workflows?

Sent handles messaging delivery, but most teams need a collaborative API tool for testing, documentation, and repeated validation. That's where Apidog adds value.

Top comments (0)