API Docs for: 2.6
Show:

sms Class

Module: sms

Provides the mail functionalities.

Methods

analizeWebserviceResponse

(
  • serviceName
  • response
  • to
)
Function private

Analize the webservice response to understand if it's successful or not.

Parameters:

  • serviceName String

    The webservice name

  • response String

    The response from the webservice

  • to String

    The destination number

Returns:

Function:

The callback function

config

(
  • path
)

Configurates by a configuration file that must use the JSON syntax.

The method can throw an Exception.

Parameters:

  • path String

    The path of the configuration file

configDeliveryPortech

(
  • json
)
private

Configuration for portech usage.

Parameters:

  • json Object
    • queue_path String

      The filesystem path of the directory in which the sms will be queued into the files

configDeliveryWebservice

(
  • json
)
private

Configuration for webservice usage.

Parameters:

  • json Object
    • url String

      The parameterized url of the webservice

    • user String

      The username to use the webservice

    • method String

      The method used to make the HTTP request for the webservice (GET or POST)

    • password String

      The password to use the webservice

escapeHttpUrlArgValue

(
  • value
)
String private

Returns the escape of the specified argument value to be inserted in a HTTP URL.

Parameters:

  • value String

    The value to be escape

Returns:

String:

The escape of the value

getAllUserHistoryInterval

(
  • data
  • cb
)

Gets the history of the sms sent by all the user into the interval time. It can be possible to filter the results.

Parameters:

  • data Object
    • from String

      The starting date of the interval in the YYYYMMDD format (e.g. 20130521)

    • to String

      The ending date of the interval in the YYYYMMDD format (e.g. 20130528)

    • [filter] String optional

      The filter to be used

  • cb Function

    The callback function

getHistoryInterval

(
  • data
  • cb
)

Get the history of the sms sent by the user into the interval time. It can be possible to filter the results.

Parameters:

  • data Object
    • username String

      The username involved in the research

    • from String

      The starting date of the interval in the YYYYMMDD format (e.g. 20130521)

    • to String

      The ending date of the interval in the YYYYMMDD format (e.g. 20130528)

    • [filter] String optional

      The filter to be used

  • cb Function

    The callback function

send

(
  • from
  • to
  • body
  • cb
)

Sends an sms message.

Parameters:

  • from String

    The sender identifier

  • to String

    The destination number

  • body String

    The body of the sms message

  • cb Function

    The callback function

sendSmsByHttpGet

(
  • to
  • body
  • cb
)
private

Sends an sms using a GET HTTP request.

Parameters:

  • to String

    The destination number

  • body String

    The text of the sms

  • cb Function

    The callback function

sendSmsByHttpPost

(
  • to
  • body
  • cb
)
private

Sends an sms using a POST HTTP request.

Parameters:

  • to String

    The destination number

  • body String

    The text of the sms

  • cb Function

    The callback function

sendSmsByPortech

(
  • from
  • to
  • body
  • cb
)
private

Creates a file in the sms queue directory. After that, the script sendsms.php will read the file and will send the sms message to the destination number. The script executes each interval of time.

Parameters:

  • from String

    The sender identifier

  • to String

    The destination number

  • body String

    The text of the sms

  • cb Function

    The callback function

sendSmsByWebservice

(
  • to
  • body
  • cb
)
private

Sends an sms using a webservice.

Parameters:

  • to String

    The destination number

  • body String

    The text of the sms

  • cb Function

    The callback function

sendSmsByWebserviceCb

(
  • err
  • from
  • to
  • body
  • cb
)

The callback of the sendSmsByWebservice method.

Parameters:

  • err Object

    The callback error

  • from String

    The sender identifier

  • to String

    The destination number

  • body String

    The body of the sms message

  • cb Function

    The callback function

setCompDbconn

(
  • comp
)

Sets the database architect component.

Parameters:

  • comp Object

    The database architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

storeSmsFailure

(
  • username
  • to
  • body
)
private

Store an sms sending failure in the database.

Parameters:

  • username String

    The name of the user who sent the sms

  • to String

    The destination number

  • body String

    The text of the message

storeSmsSuccess

(
  • username
  • to
  • body
)
private

Store a successfully sms sending in the database.

Parameters:

  • username String

    The name of the user who sent the sms

  • to String

    The destination number

  • body String

    The text of the message

Properties

compDbconn

Object private

The architect component to be used for database.

deliveryType

String private

The sms delivery type. The allowed type is defined in sms_delivery_types.js file. It's defined into the configuration file.

IDLOG

String private final

The module identifier used by the logger.

Default: [sms]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

portech

Object private

The configurations used to send sms by portech. It's initialized by the configuration file.

Default: { queuePath: "" }

prefix

String private

The prefix number to be used. It's defined into the configuration file.

Default: ""

webservice

Object private

The configurations used to send sms by webservice. It's initialized by the configuration file.

Default: {}