Spanish Total.js
English
Documentation For AI agents
Contents

Messages

Send emails and text messages, and store log messages.

.md Website
On this page

Every service is a POST request with your token. See Call Total API from Total.js and Call Total API over HTTP.

API

rest

POST https://api.totaljs.com/mail/

Sends an email.
ParameterTypeDescription
to Array The email addresses of the recipients.
subject String The subject.
body String The message as HTML.
from? String The name of the sender (a name, not an email address).
cc? Array Email addresses for a copy.
bcc? Array Email addresses for a hidden copy.
reply? Array Email addresses for the answers.
priority? Number 1 high, 3 normal, 5 low. Default: 3
confidential? Boolean Marks the email as confidential.
unsubscribe? String The address of a page to unsubscribe.

Returns Object { "success": true } when the email is sent.

The emails are sent from noreply@totaljs.com. A Total.js application can send all its emails through this service: see Call Total API from Total.js.

Total.js
await API('TAPI', 'mail', { from: 'Demo Shop', to: ['jane@example.com'], subject: 'Your order', body: '<p>Thank you for your order.</p>' }).promise();
REST
curl -X POST https://api.totaljs.com/mail/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "from": "Demo Shop", "to": ["jane@example.com"], "subject": "Your order", "body": "<p>Thank you for your order.</p>" }'
Response
{ "success": true }
rest

POST https://api.totaljs.com/sms/

Sends a text message.
ParameterTypeDescription
from String The name of the sender.
to String The phone number with its country code, for example +421900000000.
body String The message.

Returns Object { "success": true } when the message is sent.

The price of a message can vary.

Total.js
await API('TAPI', 'sms', { from: 'Demo Shop', to: '+421900000000', body: 'Your order is on its way.' }).promise();
REST
curl -X POST https://api.totaljs.com/sms/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "from": "Demo Shop", "to": "+421900000000", "body": "Your order is on its way." }'
Response
{ "success": true }
rest

POST https://api.totaljs.com/logger/

Stores a log message in the Total.js Platform.
ParameterTypeDescription
app String The name of the application, up to 40 characters.
message String The message, up to 500 characters.
type? String info, warning, error or success. Default: info
url? String An address, up to 100 characters.
reference? String A reference of your own, up to 50 characters.
data? String Data of your own as JSON text.
ua? String The user agent, up to 30 characters.
ip? String The IP address, up to 60 characters.
userid? String The id of the user, up to 25 characters.
username? String The name of the user, up to 50 characters.

Returns Object The answer of the service.

A request can have up to 50 kB. A Total.js application can send all its audit logs to this service: see Call Total API from Total.js.

Total.js
await API('TAPI', 'logger', { app: 'Demo Shop', type: 'info', message: 'The daily import has finished.' }).promise();
REST
curl -X POST https://api.totaljs.com/logger/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "app": "Demo Shop", "type": "info", "message": "The daily import has finished." }'
Made in Europe