Overview
POST
/messaging/sendmessagingSend an email/SMS to a user — freeform or via a template (admin)
Create a record in send.
Auth: bearerAuth — calls run as the authenticated user.
Request body
application/json · optional
- userIdstring
Target user id
- channel"email" | "sms"
- subjectoptionalstring
Email subject (freeform)
- bodyoptionalstring
Freeform message body
- templateIdoptionalstring
Template id (alternative to body)
- templateVarsoptionalobject
Substitution values for the template placeholders
- recipientoptionalstring
Override recipient; required for SMS, optional for email
Example
{
"userId": "string",
"channel": "email",
"subject": "string",
"body": "string",
"templateId": "string",
"templateVars": {},
"recipient": "string"
}Responses
200
Sent
- status"sent" | "failed"
- providerIdoptionalstring
Provider message id (on success)
- erroroptionalstring
Failure reason (on failure)
Example
{
"status": "sent",
"providerId": "string",
"error": "string"
}400
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}401
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}403
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}422
Send failed (e.g. provider unconfigured); logged with status failed
- status"sent" | "failed"
- providerIdoptionalstring
Provider message id (on success)
- erroroptionalstring
Failure reason (on failure)
Example
{
"status": "sent",
"providerId": "string",
"error": "string"
}Code examples
cURL
curl -X POST "https://api.agenticdeveloperhub.com/messaging/send" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"userId": "string",
"channel": "email",
"subject": "string",
"body": "string",
"templateId": "string",
"templateVars": {},
"recipient": "string"
}'JavaScript
const res = await fetch("https://api.agenticdeveloperhub.com/messaging/send", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: "{\n \"userId\": \"string\",\n \"channel\": \"email\",\n \"subject\": \"string\",\n \"body\": \"string\",\n \"templateId\": \"string\",\n \"templateVars\": {},\n \"recipient\": \"string\"\n}",
});
const data = await res.json();