SMS, Email and Voice notifications
Easy to use
This package is designed to be an easy way to use Afilnet API services. You can send SMS, email and voice notifications using your Afilnet account.
You only need an Afilnet account with enought credits. If you do not have an account, you can create it in a few minutes.
Example
var afilnet = ; afilnet; //You must login correctly or all services will return error bad user/pass //SEND SIMPLE SMSafilnetsms; //SEND EMAIL FROM TEMPLATEafilnetemail; //SEND VOICE TO GROUPafilnetvoice;
Index
Afilnet
Afilnet is a company dedicated to Cloud Marketing.
With this module we seek to facilitate the use of the services we offer through our API.
We offer support to our clients if they have some trouble with their accounts or our services.
If you notice some error or bugs, feel free to contact us.
Website
We are available in 3 different languages:
- Español - www.afilnet.com
- English - www.afilnet.us
- English - www.afilnet.co.uk
- Français - www.afilnet.fr
Setup
ATTENTION: You need an Afilet account with credits to use this module
If you dont have an account, visit our web page and create it.
After that, you will have to buy some credits to be able to send the notifications
We have a promo to test the services which give you 10 credits for free
Once you have an account, we are ready to setup the module in your app:
The first step is require the module.
var afilnet = ;
Then login with your account credentials. (You must login correctly or all services will return error bad user/pass)
afilnet;
If you have been successfully logged in, we are ready to use the services :)
Afilnet API Services
There are 4 channels availables:
This library use the structure:
afilnetchannel;
User has two services:
- getBalance (Get balance of your account)
- getUsername (Return username of the logged account) This service return a variable, so it doesn't require callback function
SMS, Email and Voice have the same services:
- send (Send to a single user)
- sendFromTemplate (Send to a single user using a template)
- sendToGroup (Send to a defined group)
- sendToGroupFromTemplate (Send to a defined group using a template)
- getDeliveryStatus (Get delivery status of a message)
User
If you want to check User parameters you only need to call the object user and the service required.
Services
//GET BALANCEafilnetuser; //GET USERNAMEvar accountUsername = afilnetuser;
Example
var accountUsername = afilnetuser; afilnetuser;
SMS
If you want to use SMS you only need to call the object sms and the service required.
Services
//SENDafilnetsms; //SEND FROM TEMPLATEafilnetsms; //SEND TO GROUPafilnetsms; //SEND TO GROUP FROM TEMPLATEafilnetsms; // GET DELIVERY STATUSafilnetsms;
Example
var to = "34600000000";var message = "Hey Luke, I want to tell you something... I am your father.";var from = "Darth Vader"; afilnetsms;
If you want to use Email you only need to call the object sms and the service required.
Services
//SENDafilnetemail; //SEND FROM TEMPLATEafilnetemail; //SEND TO GROUPafilnetemail; //SEND TO GROUP FROM TEMPLATEafilnetemail; // GET DELIVERY STATUSafilnetemail;
Example
var to = "luke_skywalker@newjediorder.com";var subject = "I have a surprise for you - Darth Vader";var message = "<h2>I am your father.</h2><hr><p>Hehehe surprise.</p><p>Best wishes, Darth Vader.</p>"; afilnetemail;
Voice
If you want to use Voice you only need to call the object sms and the service required.
Services
//SENDafilnetvoice; //SEND FROM TEMPLATEafilnetvoice; //SEND TO GROUPafilnetvoice; //SEND TO GROUP FROM TEMPLATEafilnetvoice; // GET DELIVERY STATUSafilnetvoice;
Example
var to = "346000000";var message = "Hey Luke, I want to tell you something... I... am... your father.";var lang = "EN"; afilnetvoice;
RESPONSE
All services receive similar parameters but all return same JSON object.
The services will return a JSON object with the next structure:
- status
- error (if status=ERROR), here you will receive the error code
- result (if status=SUCCESS), here you will receive the following values:
- messageid
- credits
ERROR CODES
Code | Description |
---|---|
MISSING_USER | User or email not included |
MISSING_PASSWORD | Password not included |
MISSING_CLASS | Class not included |
MISSING_METHOD | Method not included |
MISSING_COMPULSORY_PARAM | Compulsory parameter not included |
INCORRECT_USER_PASSWORD | Incorrect user or password |
INCORRECT_CLASS | Incorrect class |
INCORRECT_METHOD | Incorrect method |
NO_ROUTE_AVAILABLE | There are no available paths for the indicated destination |
NO_CREDITS | Your balance is insufficient |
Example
- If everything is ok:
- If something went bad: