1.1.0 • Published 8 years ago

bouygues-sms v1.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

bouygues-sms

npm version npm

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

Usage

Installation

npm install bouygues-sms

Auth + send "Hello World!" to 0600000000

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");
  }
});

Get quota left

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");
  }
})

Send to multiple numbers (up to 5)

sms.send("Hello World!", ["0600000001", "0600000002", "0600000003", "0600000004", "0600000005"], (error) => {
  if(error) {
    console.log("An error occured: " + error.code)
  } else {
    console.log("success");
  }
});

Error codes

CodeMeaning
LOGIN_UNKNOWNLogin page has changed or Bouygues services are down
LOGIN_WRONGCredentials are wrong
QUOTA_EXCEEDEDQuota is exceeded and SMS can't be sent
ERROR_GETQUOTAError getting quota, page has changed or Bouygues services are down
SMS_CONFIRMATIONError at SMS confirmation, page has changed or Bouygues services are down
SMS_RESULTError at SMS result, page has changed or Bouygues services are down

Notes

  • 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 ...
1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago