Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages

About API

Вы здесь:

UniSender API is a special interface for developers, which allows you to integrate the possibility of – email campaigns with almost any open-source web service or a desktop application. Our API provides contact list managing, creation and sending of various types of messages and obtaining campaign’s statistics. Partner and reseller schemes can also be set up by the API.

Working with API is free for all accounts. It is enough to enable the access to it and get API key in your Personal account. The API key is confidential and should not be passed to others or be visible in the web page’s source code, due to the possibility of illegal usage for sending emails on your behalf.

UniSender API for your business

Properly made UniSender integration will greatly simplify email marketing for your company. You won’t have to manually synchronize lists all the time and everything will be done automatically. Automation examples:

  • automatic adding of all new customers from your online store into a UniSender list;
  • synchronization of contacts’ statuses with your existing CRM;
  • creation of special sections for the delivery of electronic mailing services to Internet portals;
  • downloading of campaigns’ statistics into the systems of analysis and data mining;

The principle of API usage

Make an HTTPS request to the URL of the following type:

https://api.unisender.com/LANG/api/METHOD?format=json&api_key=KEY
&arg1=ARG_1&argN=ARG_N

where:

  • LANG * – the language of API server messages, ru, en, it are possible at the moment;
  • METHOD * – the name of the method;
  • KEY * – API access key;
  • ARG_1 … ARG_N – parameters’ values.

All the parameters must be encoded in UTF-8. In the example above the parameters are indicated in the GET request, but you can pass them in the POST request. Moreover, we strongly recommend passing the parameter API_key through POST request to avoid its storing in proxy servers’ logs.

UniSender API responds with JSON objects.

Both the request and the response can be compressed by gzip or bzip2 algorithms.

Result of a successful method call

If the call is successful, the object will contain the «result» field, the content of which depends on the method called and will not contain the «error» field. But even if the method has been executed successfully, there may be a «warning» field containing an array of warning objects with the only «warning» string field.

Example of a successful method call:

{
  "result":{
    "message_id":34423432
  },
  "warnings":[
    {"warning":"probably not a mobile phone"}
  ]
}

Result of an unsuccessful method call

An indicator of an error in executing the method is the presence of the “error” field with an HTML error message in the response object. In addition, the response object will also contain a “code” field with the string error code in case of an error. In case of an error, the «result» field should be ignored.

Errors in working with API

List of methods

  1. Working with contact lists
  2. Working with additional fields and tags
  3. Creating and sending messages
  4. Working with templates
  5. Obtaining statistics
  6. Methods for partner sites

Working with contact lists

Working with additional fields and tags

Creating and sending messages

Working with templates

Obtaining statistics

Methods for partner sites

System Event Notification — Webhooks

To address the task of notifying about changes in the delivery status, we have made a new API that will give you the opportunity to register and manage notifications handlers, the so-called Webhooks.

Please find a detailed article here.

The procedure of methods calls

You can have one or several lists — it is assumed that each list corresponds to a specific campaign topic, and the email recipient can be subscribed to one list and not be subscribed to another one.

Before sending an email or SMS’s on the list of the recipients, you need to know the list code using the getLists method, or create a new list using the createList method. Next, you need to add contacts to the list — either all of them using the importContacts method, or one by one using the subscribe method.

Then, you can send messages. Create a message using the createEmailMessage (or createSmsMessage) method. When doing this, you specify the id of the list with email recipients — and the email will be addressed to all email recipients from these lists that are active at the time of calling createEmailMessage / createSmsMessage method. If this is an automatically sent message such as “Step by Step Slimming in 10 Days” or something similar, this will be the last action, and the message will be sent as soon as you need. If this is not a serial message, you need to call the createCampaign method to send the created message.

If you need to send another message on the same list, call createEmailMessage / createSmsMessage again and continue with the actions described in the previous paragraph.

If you do not need to change the text of the message, but you need to send the same message again on the same list, you can call createCampaign again with the same message_id.

After completion of the campaign, you can get the sending results using the getCampaignDeliveryStats method.

Quick start

We have prepared a library for the PHP class so that you can quickly add the possibility of guaranteed sending messages to your web project, as well as basic guidelines to create integrations.