Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

exotel-node

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exotel-node - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

36

exotel.js

@@ -1,2 +0,3 @@

var request = require('request');
var request = require('request');
var parseString = require('xml2js').parseString;

@@ -19,3 +20,9 @@ module.exports = {

makeRequest(url, params, callback);
makeRequest(url, params, function(error, response) {
if (error) {
callback(error, null);
} else {
callback(null, response.TwilioResponse.SMSMessage);
}
});
},

@@ -33,4 +40,23 @@

makeRequest(url, params, callback);
makeRequest(url, params, function(error, response) {
if (error) {
callback(error, null);
} else {
callback(null, response.TwilioResponse.Call);
}
});
},
getCallDetails : function(id, callback) {
var url = 'https://' + this.exotel_sid + ':' + this.exotel_token + '@twilix.exotel.in/v1/Accounts/' + this.exotel_sid +'/Calls/' + id;
request.get(url, function (error, response, body) {
if (error) {
callback(error, response);
} else {
parseString(response.body, {explicitArray: false}, function(err, result) {
callback(null, result.TwilioResponse.Call);
});
}
});
}
}

@@ -43,5 +69,7 @@

} else {
callback(null, body);
parseString(response.body, {explicitArray: false}, function(err, result) {
callback(null, result);
});
}
});
}

5

package.json
{
"name": "exotel-node",
"version": "0.0.2",
"version": "0.0.3",
"description": "A NodeJs wrapper for Exotel APIs",

@@ -27,4 +27,5 @@ "main": "exotel.js",

"dependencies": {
"request": "^2.69.0"
"request": "^2.69.0",
"xml2js": "^0.4.16"
}
}
# Exotel NodeJs Wrapper
A NodeJs wrapper for Exotel APIs
A NodeJs wrapper for Exotel APIs. Converts Exotel XML response to Javascript object.

@@ -15,2 +15,3 @@ ```npm install exotel-node```

* [Connect call](#connect_call)
* [Get call details](#get_call_details)

@@ -20,3 +21,5 @@ ### <a name="send_sms"></a>Send SMS

Exotel.sendSMS(TO_NUMBER, MESSAGE, function(error, response) {
console.log(response);
if (!error) {
console.log(response);
}
});

@@ -28,7 +31,29 @@ ```

Exotel.connectCall(AGENT_NUMBER, CUSTOMER_NUMBER, function(error, response) {
console.log(response);
if (!error) {
console.log(response);
}
});
```
### <a name="get_call_details"></a>Get call details
```javascript
Exotel.getCallDetails(CALL_SID, function(error, response) {
if (!error) {
console.log(response);
console.log(response.DateCreated); // Date created
console.log(response.DateUpdated); // Date updated
console.log(response.AccountSid); // Account SID used to create the call
console.log(response.To); // Customer number/2nd number in API call
console.log(response.From); // Agent number/1st number in API call
console.log(response.Status); // Call status
console.log(response.StartTime); // Call start time
console.log(response.EndTime); // Call end time
console.log(response.Duration); // Call duration
console.log(response.Price); // Call cost
console.log(response.RecordingUrl); // Call recording url
}
});
```
---
### Submit issues
You can raise an issue in this repo or mail me at sidhant@hashexclude.com
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc