Client API for Sales.lv Premium service. In its essence Premium is a platform for implementing services based on mobile-originated (incoming from users) SMS message processing. In practice there are a number of applications built upon this platform, for example, user message processing, SMS micropayment handling, lotteries, etc. (Lotteries are a special case as there is a lot of lottery-specific functionality implemented in Premium that goes above and beyond SMS processing).
This is a simple HTTP API where data is requested or manipulated with HTTP requests. We are also providing client libraries (currently only in PHP) to make work easier.
There is a specification provided in the wiki here about making the API calls yourself, as well as examples of using our libraries
- Sign up for the Premium service with Sales.lv. Once you have done that, you will be provided with an API key and a campaign code to use for API requests.
- Take a look at the API documentation and the client libraries.
PHP client library is located in lib/php/premium-api.php
. An usage example is provided in lib/php/example.php
.
Requirements:
- PHP 5.5 or newer
- One of these:
- cURL extension.
- pecl_http extension.
- allow_url_fopen set to true (attachment file upload is not currently supported for this method.)
Library usage is described in the wiki.
1.3.0:
- Changed to prefer cURL for making HTTP requests.
- PHP version number passed to Premium in user agent.
1.2.1:
- Minor fixes for PHP 8.1 compatibility.
1.2.0:
- Some message parameters can be passed as arrays to submit multiple values (if permitted in campaign settings.)
- An error code is returned when registration count per participant has reached a certain limit, if it's set up like that in campaign settings.
1.1.1:
- New error codes added for attachments
1.1.0:
- compatibility moved up to 5.5;
- some error messages indicate data unavailability due to GDPR limitations;
- files can be attached to submitted messages for upload and storage in Premium (when required by the campaign)
1.0.*:
- initial releases
Please write to support@sales.lv with any feedback, questions or suggestions that might arise.