Skip to content
SocialMate
Knowledge base Developer API & automation

Send from your own code (curl / Node / Python)

Copy-paste snippets to send a message from the shell, Node, or Python in under a minute.

1 min read Updated July 14, 2026

The API is just HTTP + JSON, so any language works. Here’s the same “send a message” call three ways.

The send endpoint is POST /v1/accounts/{accountId}/messages with a chatId (the recipient’s phone number in international format, or a group @g.us JID) and text. List accounts at GET /v1/accounts to get an id.

curl

curl http://localhost:3456/v1/accounts/ACCOUNT_ID/messages 
  -H "x-api-key: YOUR_KEY" 
  -H "Content-Type: application/json" 
  -d '{"chatId":"15551234567","text":"Hello from SocialMate"}'

Node.js

const res = await fetch(
  `http://localhost:3456/v1/accounts/${process.env.SM_ACCOUNT_ID}/messages`,
  {
    method: "POST",
    headers: {
      "x-api-key": process.env.SM_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      chatId: "15551234567",
      text: "Hello from SocialMate",
    }),
  },
);
console.log(await res.json());

Python

import os, requests
acct = os.environ["SM_ACCOUNT_ID"]
requests.post(
    f"http://localhost:3456/v1/accounts/{acct}/messages",
    headers={"x-api-key": os.environ["SM_API_KEY"]},
    json={"chatId": "15551234567", "text": "Hello from SocialMate"},
)

Tip. Read your key and account id from environment variables (as above), never hard-code them. Text send works on Free; for media and group sends (Pro), see the OpenAPI docs for the exact request shapes.

Was this helpful?

Still stuck — open a ticket · Back to all articles

Free forever · no card Download free