Package to use the Bouygues Telecom SMS unofficial API (5 SMS /day limitation)
Uses calls from this page, and based on this php script
- ES6 (needs Node.JS >= 6.0.0)
- 5 SMS /day
- Quota reset at midnight
- 160 chars limit (message is truncated after the limit)
- Error(s) management
- Only ≈125 lines
npm install bouygues-sms
const Bouygues = require("bouygues-sms");
var sms = new Bouygues("bouygueslogin", "bouyguespassword", 1); // 3rd argument is for debug log (1 for enabled, 0 for disabled)
sms.send("Hello World!", "0600000000", (error) => {
if(error) {
console.log("An error occured: " + error.code)
} else {
console.log("success");
}
});
Left quota is checked at sms sending, no need to double check it (don't put a sms.send in the getQuota callback)
sms.getQuota((quota, error) => {
if(error) {
console.log("An error occured: " + error.code)
} else {
console.log(quota + " sms left today");
}
})
sms.send("Hello World!", ["0600000001", "0600000002", "0600000003", "0600000004", "0600000005"], (error) => {
if(error) {
console.log("An error occured: " + error.code)
} else {
console.log("success");
}
});
Code | Meaning |
---|---|
LOGIN_UNKNOWN | Login page has changed or Bouygues services are down |
LOGIN_WRONG | Credentials are wrong |
QUOTA_EXCEEDED | Quota is exceeded and SMS can't be sent |
ERROR_GETQUOTA | Error getting quota, page has changed or Bouygues services are down |
SMS_CONFIRMATION | Error at SMS confirmation, page has changed or Bouygues services are down |
SMS_RESULT | Error at SMS result, page has changed or Bouygues services are down |
- I'm NOT affiliated with Bouygues Telecom or one of its branches
- This module may not work if Bouygues change the service, then please report it by creating an issue
- Emojis chars are replaced by a "?" by the Bouygues server ...