NAV Navbar
curl php javascript ruby python java

Introduction 1234

Welcome to the TruSender API! You can use our API to access TruSender API endpoints, which can get information on customers, events, email templates from your account.

We have language bindings in Shell, Ruby, Python, PHP, Java and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. For each API we have given the simple code samples which you can copy and paste it in your application to get the details about that api.

Run in Postman We’ve created a Postman collection to make testing and working with our API simpler.
Run in Postman

Official Libraries

Questions or problems?

Have you run into difficulties or can’t get something to work just right? Get in touch via support@trusender.com and we’d be happy to help. You can talk to our customer support here

Authentication

To authorize, use this code:

require 'kittn'

api = Kittn::APIClient.authorize!('meowmeowmeow')
import kittn

api = kittn.authorize('meowmeowmeow')
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
  -H "Authorization: meowmeowmeow"
const kittn = require('kittn');

let api = kittn.authorize('meowmeowmeow');

Make sure to replace meowmeowmeow with your API key.

To authenticate against the Vero API, you need to use your auth_token in each request. Your auth_token can access all of your data and, with future API releases, will be able to read from Vero too. Ensure you keep it secret!

To access your API credentials, visit the Settings page within your TruSender account.

Requests are authenticated by providing a parameter called auth_token containing your auth_token with each request.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. You must authenticate for all requests.

Errors

The Kittn API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

Installation

Here is the step how to install package. If there are any issues with the installation please write to us, we are happy to help you.

SendEmail

The customers endpoint lets you create, update and manage the subscription status of your customers.

curl "http://example.com/api/kittens"
  -H "Authorization: meowmeowmeow"
$ts = new TruSender("YOUR_AUTH_TOKEN");
$bbm->find("email@address.com");
const kittn = require('trusender');

let api = trusender.authorize('meowmeowmeow');
let customer = api.customers.get("email@address.com");
require 'trusender'

api = TruSender::APIClient.authorize!('meowmeowmeow')
api.customers.get("email@address.com")
import trusender

api = trusender.authorize('meowmeowmeow')
api.customers.get("email@address.com")
import org.trusender.client;


The above command returns JSON structured like this: json { "id": 1, "name": "Fluffums", "breed": "calico", "fluffiness": 6, "cuteness": 7 }

This endpoint used to send the email template to the specific user.

HTTP Request

POST https://api.trusender.com/v1/sendEmail

Query Parameters

Parameter Default Description
auth_token None Token will be differnet for sandbox (test) and live environments and you should be able to get it from the settings page.
email None Manadatory field, valid email address has to be there. Specified template will be send to this email address.
template_name None Manadatory field, valid email address has to be there, this will be Handlebars template that can be created from the admin panel.
data_mapping {} Dynamic fields those needs to be replaced in the Handlebars template

SendEvent

The customers endpoint lets you create, update and manage the subscription status of your customers.

curl "http://example.com/api/kittens"
  -H "Authorization: meowmeowmeow"
$ts = new TruSender("YOUR_AUTH_TOKEN");
$bbm->find("email@address.com");
const kittn = require('trusender');

let api = trusender.authorize('meowmeowmeow');
let customer = api.customers.get("email@address.com");
require 'trusender'

api = TruSender::APIClient.authorize!('meowmeowmeow')
api.customers.get("email@address.com")
import trusender

api = trusender.authorize('meowmeowmeow')
api.customers.get("email@address.com")
import org.trusender.client;


The above command returns JSON structured like this: json { "id": 1, "name": "Fluffums", "breed": "calico", "fluffiness": 6, "cuteness": 7 }

This endpoint retrieves all kittens.

HTTP Request

GET http://example.com/api/kittens

Query Parameters

Parameter Default Description
include_cats false If set to true, the result will also include cats.
available true If set to false, the result will include kittens that have already been adopted.