Socket
Socket
Sign inDemoInstall

twiliojs-api

Package Overview
Dependencies
6
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

10

package.json
{
"name": "twiliojs-api",
"version": "0.0.2",
"version": "0.0.3",
"description": "Module to invoke twilio.com services",

@@ -8,4 +8,4 @@ "author": "Kidozen <development@kidozen.com>",

{
"name" : "Development",
"email" : "development@kidozen.com"
"name" : "Gustavo Machado",
"email" : "gus@kidozen.com"
}, {

@@ -20,6 +20,2 @@ "name" : "Christian Carnero",

},
"repository": {
"type": "git",
"url": "https://github.com/kidozen/node-twilio-api.git"
},
"keywords": [

@@ -26,0 +22,0 @@ "kidozen",

@@ -1,569 +0,1 @@

# Twilio client for Nodejs
This node module provides a set of methods to interact with Twilio Online services.
It allows to query meta-data about your account, phone numbers, calls, text messages, and recordings. You can also do some fancy things like initiate outbound calls and send text messages.
The module was created as part of [KidoZen](http://www.kidozen.com) project, as a connector for its Enterprise API feature.
## Installation
Use npm to install the module:
```
> npm install twiliojs-api
```
## API
Due to the asynchrounous nature of Nodejs, this module uses callbacks in requests. All callbacks have 2 arguments: `err` and `data`.
```
function callback (err, data) {
// err contains an Error class instance, if any
// data contains the resulting data
}
```
### Constructor
The module exports a class and its constructor requires a configuration object with following properties
* `accountSid`: Twilio Account SID.
* `accountToken`: Twilio Auth Token.
```
var Twilio = require("twiliojs-api");
var twilio = new Twilio({
accountSid: "...",
accountToken: "..."
});
```
### Methods
All public methods has the same signature. The signature has two arguments: `options` and `callback`.
* `options` must be an object instance containig all parameters for the method.
* `callback` must be a function.
### Accounts
An Account instance resource represents a single Twilio account.
#### getAccount (options, callback)
Returns a representation of an account. This list includes that account, along with any subaccounts belonging to it.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `FriendlyName`: String. Update the human-readable description of this account
* `Status`: String. Only return Account resources with the given status. Can be closed, suspended or active.
* `callback`: A required function for callback.
#### updateAccount (options, callback)
**Parameters:**
* An object instance containing filter's parameters:
* `friendly_name`: String. Update the human-readable description of this account
* `status`: String. Alter the status of this account: use closed to irreversibly close this account, suspended to temporarily suspend it, or active to reactivate it.
* `callback`: A required function for callback.
#### createSubAccount (options, callback)
Creates a new Twilio Subaccount. For more information about subaccount please check http://www.twilio.com/docs/api/rest/subaccounts#creating-subaccounts
**Parameters:**
* An object instance containing filter's parameters:
* `friendly_name`: String. Update the human-readable description of this account
* `callback`: A required function for callback.
### SMS Messages
An SMS Message instance resource represents an inbound or outbound SMS message.
#### getSMS (options, callback)
Returns a single SMS message specified by the provided {SMSMessageSid}
**Parameters:**
* An object instance containing filter's parameters:
* `SMSMessageSid`: String. SMS message id
* `callback`: A required function for callback.
#### sendSMS (options, callback)
Sends a new SMS message.
**Parameters:**
* An object instance containing filter's parameters:
* `from`: String. A Twilio phone number enabled for SMS. Only phone numbers or short codes purchased from Twilio work here; you cannot (for example) spoof SMS messages from your own cell phone number.
* `to`: String. The destination phone number. Format with a '+' and country code e.g., +16175551212 (E.164 format). For 'To' numbers without a '+', Twilio will use the same country code as the 'From' number. Twilio will also attempt to handle locally formatted numbers for that country code (e.g. (415) 555-1212 for US, 07400123456 for GB). If you are sending to a different country than the 'From' number, you must include a '+' and the country code to ensure proper delivery.
* `body`: String. The text of the message you want to send, limited to 160 characters.
* `status_callback`: String. Optional. A URL that Twilio will POST to when your message is processed. Twilio will POST the SmsSid as well as SmsStatus=sent or SmsStatus=failed.
* `application_sid`: String. Optional. Twilio will POST SmsSid as well as SmsStatus=sent or SmsStatus=failed to the URL in the SmsStatusCallback property of this Application. If the StatusCallback parameter above is also passed, the Application's SmsStatusCallback parameter will take precedence.
* `callback`: A required function for callback.
#### allSMS (options, callback)
Returns a list of SMS messages associated with your account. The list includes paging information.
List Filters
**Parameters:**
* An object instance containing filter's parameters:
* `to`: String. Only show SMS messages to this phone number.
* `from`: String. Only show SMS messages from this phone number.
* `date_sent`: String. Only show SMS messages sent on this date (in GMT format), given as YYYY-MM-DD. Example: DateSent=2009-07-06. You can also specify inequality, such as DateSent<=YYYY-MM-DD for SMS messages that were sent on or before midnight on a date, and DateSent>=YYYY-MM-DD for SMS messages sent on or after midnight on a date.
* `callback`: A required function for callback.
### Calls
A Call instance resource represents a connection between a telephone and Twilio
#### getCall (options, callback)
Returns the single Call resource identified by {CallSid}.
**Parameters:**
* An object instance containing filter's parameters:
* `CallSid`: String. Call unique identifier
* `callback`: A required function for callback.
#### makeCall (options, callback)
Makes outgoing calls to phones, SIP-enabled endpoints and Twilio Client connections.}.
**Parameters:**
* An object instance containing filter's parameters:
* `from`: String.The phone number or client identifier to use as the caller id. If using a phone number, it must be a Twilio number or a Verified outgoing caller id for your account.
* `to`: String. The phone number, SIP address or client identifier to call.
* `callback`: A required function for callback.
### Conference
The Conference instance resource allows you to query and manage the state of individual conferences.
#### getAllConferences (options, callback)
Returns a list of conferences within an account. The list includes paging information.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `status`: String. Only show conferences currently in with this status. May be init, in-progress, or completed.
* `FriendlyName`: String. List conferences whose FriendlyName exactly matches this string.
* `DateCreated`: String. Only show conferences that started on this date, given as YYYY-MM-DD. You can also specify inequality, such as DateCreated<=YYYY-MM-DD for conferences that started at or before midnight on a date, and DateCreated>=YYYY-MM-DD for conferences that started at or after midnight on a date.
* `FrdateUpdated`: String. Only show conferences that were last updated on this date, given as YYYY-MM-DD. You can also specify inequality, such as DateUpdated<=YYYY-MM-DD for conferences that were last updated at or before midnight on a date, and DateUpdated>=YYYY-MM-DD for conferences that were updated at or after midnight on a date.
* `callback`: A required function for callback.
#### getConference (options, callback)
Returns a representation of the conference identified by {ConferenceSid}.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `ConferenceSid`: String.
* `callback`: A required function for callback.
#### getConferenceParticipants (options, callback)
Each Conference instance resource has a Participants subresource which represents the set of participants currently connected to a running conference.
**Parameters:**
* An object instance containing filter's parameters:
* `ConferenceSid`: String. Conference unique identifier
* `callback`: A required function for callback.
#### kickParticipant (options, callback)
Kick this participant from the conference.
**Parameters:**
* An object instance containing filter's parameters:
* `ConferenceSid`: String. Conference unique identifier
* `ParticipantSkd`: String : String. Participant unique identifier
* `callback`: A required function for callback.
#### updateParticipantStatus (options, callback)
Updates the status of a participant.
**Parameters:**
* An object instance containing filter's parameters:
* `ConferenceSid`: String. Conference unique identifier
* `ParticipantSkd`: String : String. Participant unique identifier
* `callback`: A required function for callback.
### Queues
The Queue instance resource allows you to query and manage the state of individual call queues.
#### getAllQueues (options, callback)
Returns a list of queues within an account. The list includes paging information.
**Parameters:**
* An object instance containing filter's parameters:
* `callback`: A required function for callback.
#### getQueue (options, callback)
Returns a representation of the Queue identified by {QueueSid}
**Parameters:**
* An object instance containing filter's parameters:
* `QueueSid`: String.
* `callback`: A required function for callback.
#### createQueue (options, callback)
Allows you to create a new Queue.
**Parameters:**
* An object instance containing filter's parameters:
* `FriendlyName`: String. A unique identifier for this queue
* `MaxSize`: String. The meximun size of this queue (1000)
* `callback`: A required function for callback.
#### updateQueue (options, callback)
Allows you to change the FriendlyName or MaxSize.
**Parameters:**
* An object instance containing filter's parameters:
* `QueueSid`: String. Queue unique identifier
* `FriendlyName`: String. A unique identifier for this queue
* `MaxSize`: String. The meximun size of this queue (1000)
* `callback`: A required function for callback.
#### deleteQueue (options, callback)
The DELETE method allows you to remove a Queue. Only empty queues are deletable.
**Parameters:**
* An object instance containing filter's parameters:
* `QueueSid`: String. Queue unique identifier
* `callback`: A required function for callback.
#### getAllMembers (options, callback)
Each Queue instance resource has a Members subresource which represents the set of members currently in the queue.
**Parameters:**
* An object instance containing filter's parameters:
* `QueueSid`: String. Queue unique identifier
* `callback`: A required function for callback.
#### getMember (options, callback)
Represents an specific member in the queue wich is identified by its Call unique id
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `QueueSid`: String. Queue unique identifier
* `CallSid` : String. Member call unique id
* `callback`: A required function for callback.
#### getFrontMember (options, callback)
Gets the front of the queue:
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `QueueSid`: String.
* `callback`: A required function for callback.
#### dequeueMember (options, callback)
Will dequeue a member from a queue
**Parameters:**
* An object instance containing filter's parameters:
* `QueueSid`: String. Queue unique identifier
* `CallSid` : String. Member call unique id
* `callback`: A required function for callback.
#### dequeueFront (options, callback)
Will dequeue the front member from a queue
**Parameters:**
* An object instance containing filter's parameters:
* `QueueSid`: String. Queue unique identifier
* `callback`: A required function for callback.
### Short Codes
A short code is a 5 or 6-digit number that can send and receive SMS messages with mobile phones.
#### getAllShortCodes (options, callback)
Returns a list of ShortCode resource representations, each representing a short code within your account. The list includes paging information.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `ShortCode`: String. Only show the ShortCode resources that match this pattern. You can specify partial numbers and use '*' as a wildcard for any digit.
* `FriendlyName`: String. Only show the ShortCode resources with friendly names that exactly match this name
* `callback`: A required function for callback.
#### getShortCode (options, callback)
Represents an specific Short Code wich is identified by its ShortCode unique identifier
**Parameters:**
* An object instance containing filter's parameters:
* `ShortCodeSid`: String. Short code unique identifier
* `callback`: A required function for callback.
#### updateShortCode (options, callback)
Updates an specific Short Code wich is identified by its ShortCode unique identifier
**Parameters:**
* An object instance containing filter's parameters:
* `FriendlyName`: String. A human readable description of the short code, with maximum length 64 characters.
* `ApiVersion`: String. SMSs to this short code will start a new TwiML session with this API version. Either 2010-04-01 or 2008-08-01.
* `SmsUrl`: String. The URL that Twilio should request when somebody sends an SMS to the short code.
* `SmsMethod`: String. The HTTP method that should be used to request the SmsUrl. Either GET or POST.
* `SmsFallbackUrl`: String. A URL that Twilio will request if an error occurs requesting or executing the TwiML at the SmsUrl.
* `SmsFallbackMethod`: String. The HTTP method that should be used to request the SmsFallbackUrl. Either GET or POST.
* `callback`: A required function for callback.
### Recordings
This resource represents an individual recording.
#### getRecording (options, callback)
Returns one of several representations:
**Parameters:**
* An object instance containing filter's parameters:
* `RecordingSid`: String.
* `callback`: A required function for callback.
#### getAllRecordings (options, callback)
Returns a list of Recording resource representations, each representing a recording generated during the course of a phone call. The list includes paging information.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `CallSid`: String. Show only recordings made during the call given by this sid.
* `DateCreated`: String. Only show recordings created on the given date. Should be formatted as YYYY-MM-DD. You can also specify inequality, such as DateCreated<=YYYY-MM-DD for recordings generated at or before midnight on a date, and DateCreated>=YYYY-MM-DD for recordings generated at or after midnight on a date.
* `callback`: A required function for callback.
#### getAllRecordingsTranscriptions (options, callback)
Represents the set of transcriptions available for the recording identified by {RecordingSid}.
**Parameters:**
* An object instance containing filter's parameters:
* `RecordingSid`: String. Transcription unique identifier
* `callback`: A required function for callback.
#### getAllRecordingsFromCall (options, callback)
Each Recording instance resource has a Transcriptions subresource which represents the set of transcriptions generated from the recording
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `CallSid`: String. Show only recordings made during the call given by this sid.
* `DateCreated`: String. Only show recordings created on the given date. Should be formatted as YYYY-MM-DD. You can also specify inequality, such as DateCreated<=YYYY-MM-DD for recordings generated at or before midnight on a date, and DateCreated>=YYYY-MM-DD for recordings generated at or after midnight on a date.
* `callback`: A required function for callback.
### Transcriptions
This resource represents an individual text transcription of a recorded call.
#### getTranscription (options, callback)
Returns a single Transcription resource representation identified by the given {TranscriptionSid}.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `TranscriptionSid`: String. Transcription unique identifier
* `callback`: A required function for callback.
#### getAllTranscriptions (options, callback)
Returns a set of Transcription resource representations that includes paging information.
**Parameters:**
* An object instance containing filter's parameters:
* `callback`: A required function for callback.
#### getAllRecordingsTranscriptions (options, callback)
Returns a set of Transcription resource representations that includes paging information.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `TranscriptionSid`: String. The transcription unique identifier
* `callback`: A required function for callback.
#### deleteTranscription (options, callback)
Deletes a transcription from your account.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `TranscriptionSid`: String. Transcription unique identifier
* `callback`: A required function for callback.
### Notifications
A Notification instance resource represents a single log entry made by Twilio in the course of handling your calls or your use of the REST API
#### getNotification (options, callback)
Gets an individual notification information
**Parameters:**
* An object instance containing filter's parameters:
* `NotificationSid`: String. The notification unique identifier.
* `callback`: A required function for callback.
#### getAllNotifications (options, callback)
Returns a list of notifications generated for an account. The list includes paging information.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `Log`: String. Only show notifications for this log, using the integer log values shown above.
* `MessageDate`: String. Only show notifications for this date. Should be formatted as YYYY-MM-DD. You can also specify inequality, such as MessageDate<=YYYY-MM-DD for messages logged at or before midnight on a date, and MessageDate>=YYYY-MM-DD for messages logged at or after midnight on a date.
* `callback`: A required function for callback.
#### getAllRecordingsFromCall (options, callback)
Returns a list of notifications generated for an specific Call. The list includes paging information.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `Log`: String. Only show notifications for this log, using the integer log values shown above.
* `MessageDate`: String. Only show notifications for this date. Should be formatted as YYYY-MM-DD. You can also specify inequality, such as MessageDate<=YYYY-MM-DD for messages logged at or before midnight on a date, and MessageDate>=YYYY-MM-DD for messages logged at or after midnight on a date.
* `callback`: A required function for callback.
#### deleteNotification (options, callback)
Deletes the notification identified by {NotificationSid} from an account's log.
**Parameters:**
* An object instance containing filter's parameters:
* `NotificationSid`: String. Notification unique identifier
* `callback`: A required function for callback.
### Usage
Retrieves usage made by your Twilio account during any time period and by any usage category
#### records (options, callback)
Returns UsageRecords for all usage categories. The list includes paging information.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `Category`: String. Only include usage of this usage category.
* `StartDate`: String. Only include usage that has occurred on or after this date. Format is YYYY-MM-DD. All dates are in GMT. As a convenience, you can also specify offsets to today. For example, StartDate=-30days will make StartDate be 30 days before today.
* `EndDate`: String. Only include usage that has occurred on or before this date. Format is YYYY-MM-DD. All dates are in GMT. As a convenience, you can also specify offsets to today. For example, EndDate=+30days will make EndDate be 30 days from today.
* `callback`: A required function for callback.
#### recordsSubresources (options, callback)
The main UsageRecords list resource supports a variety of convenience subresources. In general these take the form:
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `Daily`: String. Return multiple UsageRecords for each usage category, each representing usage over a daily time-interval.
* `Monthly`: String. Return multiple UsageRecords for each usage category, each representing usage over a monthly time-interval.
* `Yearly`: String. Return multiple UsageRecords for each usage category, each representing usage over a yearly time-interval.
* `AllTime`: String. Return a single UsageRecord for each usage category, each representing usage over the date-range specified. This is the same as the root /Usage/Records.
* `Today`: String. Return a single UsageRecord per usage category, for today's usage only.
* `Yesterday`: String. Return a single UsageRecord per usage category, for yesterday's usage only.
* `ThisMonth`: String. Return a single UsageRecord per usage category, for this month's usage only.
* `LastMonth`: String. Return a single UsageRecord per usage category, for last month's usage only.
* `callback`: A required function for callback.
#### triggers (options, callback)
UsageTriggers are webhooks that notify your application of usage thresholds. You can set UsageTriggers for any usage category. Returns a list of UsageTrigger resource representations. The list includes paging information.
**Parameters:**
List Filters
* An object instance containing filter's parameters:
* `Recurring`: String. Only show UsageTriggers that count over this interval. One of daily, monthly, or yearly. To retrieve non-recurring triggers, leave this empty or use alltime.
* `UsageCategory`: String. Only show UsageTriggers that watch this usage category. Must be one of the supported usage categories.
* `TriggerBy`: String. Only show UsageTriggers that trigger by this field in the UsageRecord. Must be one of: count, usage, or price as described in the UsageRecords documentation.
* `callback`: A required function for callback.
# Kidozen Enterpise API's connector for Twilio
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc