FreeMobile Plugin is a Node.js module to simplify interaction with the FreeMobile API for sending SMS messages.
Install the module using npm:
npm install freemobile-api@latestDISCLAMER : You need a subscription to Free Mobile to use this API.
const FreeMobile = require('freemobile-api');
// Replace 'YOUR_USER' and 'YOUR_PASS' with your FreeMobile credentials
const credentials = { user: 'YOUR_USER', pass: 'YOUR_PASS' };
const freeMobile = new FreeMobile(credentials);
// Send an SMS
freeMobile.send('Hello World!')
.then(response => console.log('SMS sent:', response))
.catch(error => console.error('Error:', error.message));The FreeMobile Node.js Plugin provides a simple API with the following methods:
Creates a new instance of the FreeMobile class with the specified credentials.
- Parameters:
credentials(Object): An object containing the following properties:user(String): Your FreeMobile account number.pass(String): Your FreeMobile API key.
Sends an SMS message through the FreeMobile API.
-
Parameters:
message(String): The text of the SMS message to be sent.
-
Returns:
- A Promise that resolves with the API response.
The API has a limit of 999 characters. If your message is longer, the plugin breaks it into chunks, each no longer than 999 characters. This helps ensure successful message delivery through the API without exceeding its limits.
FreeMobile API has limited emoji support due to charset restrictions. Most emojis will be automatically replaced by "[]" to avoid errors.
If you want more features, see contributions
API codes are not more than HTTP codes.
- 200 : Success - SMS sent
- 400 : One or multiple parameters are missing or incorrect
- 402 : Too many request. Try again later
- 403 : Acces denied, make sure the option is enabled on your FreeMobile account or check your credentials.
- 500 : Server internal error. Try again later. (You maybe sent a wrong message, try to avoid emojis or special caracters.)
Feel free to open issues or submit pull requests. Contributions are welcome! (In the limits of the FreeMobile API.)
This project is licensed under Apache 2.0 License - see the LICENSE file for details.