bminer / node-twilio-api Goto Github PK
View Code? Open in Web Editor NEWA high-level Twilio helper library to make Twilio API requests, handle incoming requests, and generate TwiML
License: MIT License
A high-level Twilio helper library to make Twilio API requests, handle incoming requests, and generate TwiML
License: MIT License
Create and test the ability to receive incoming SMS messages using the newly created 'incomingSMS' event.
It's possible that Twilio is sending an HTTPS request to your application, and if your Node application is behind a HTTPS proxy, node-twilio-api will think that the request is a plain-old HTTP request (i.e. not HTTPS) and generate an incorrect HMAC-SHA1 signature.
Hi there,
I could fetch 1000 messages from twilio api, after that i'm getting error messages resource not fount.
How do i get more messages, the code which i've used is as below.
Please help me here...
var twilio = require('twilio');
var accountSid = 'ACxxx';
var authToken = 'yyy';
var client = twilio(accountSid, authToken);
var baseUrl = 'https://' + accountSid + ': '+ authToken + '@' + client.host;
function handleResults(err, data) {
if (err) {
return console.error(err);
}
// do something with current page...
console.log(data.messages);
if (data.numPages > 1) {
// request the next page in the janky way
client.request({
url: baseUrl + data.nextPageUri,
qs: {
// need to use actual REST API parameter - this method does not
// massage inputs, it's pretty much a direct passthrough to
// the underlying HTTP client (mikeal/request)
PageSize: 1000
}
}, handleResults);
}
}
// fetch resources normally
client.listMessages({
pageSize: 1000
}, handleResults);
Thanks,
Sudhakar
Hey Blake,
I've been trying to build the following:
http://forum.twilio.com/twilio/topics/is_this_possible_receive_a_call_attempt_to_forward_to_two_other_numbers_simultaneously_if_that_fails_take_a_message
And came up with the following code:
https://gist.github.com/2011413
Can you give it a quick skim and tell me if I am even on the right track, and provide any advice at all. No need to take longer than a few seconds if you don't want to, just want to know if I'm wasting my time or whether I'm rocking it up. Thanks mate :)
Hello,
I've been using twilio-api to set up a simple call center, but I found that on the Twilio monitor page I'm getting Warning: 15003 - Call Progress: Error Response to Callback URL. For what I can see when I use:
call.on('ended', function(status, duration){
console.log(status);
console.log(duration);
});
That is basically the callback route. So I wonder what I should do to not get this warning.
I can't manage to get both cb() and cbifempty() working, after making a phone call to Twilio.
Here is my actual code :
function emptyCB(a,v) {
console.log("EMPTY", a, v)
}
function functionCB(call, recordingUrl, recordingDuration, input) {
console.log(call, recordingUrl, recordingDuration, input)
}
app.post('/voice', function (req, res) {
var twiml = new twilio.TwimlResponse();
twiml.say('Hello. This is my webtask to record your call.');
twiml.record(functionCB, {maxLength : "50"}, emptyCB);
twiml.hangup();
res.type('text/xml');
res.send(twiml.toString());
});
Any idea why this isn't working?
Thanks!
Hi! I'm quite excited to use the library, but I'm running into an issue with registering an application. Do I use the SID of an existing app? When I try that, it throws "Error: This application cannot be registered because required fields are missing or invalid."
The code is literally copied from the readme, with the SID's replaced. Thanks!
Modify /tests/server.js and test making multiple calls and bridging them.
Thanks for your great work with this lib.
Would you please show some more samples in addition to whats in the repo and the /test. Perhaps sme samples of generating a "record" twiML would be great.
ie. on incoming calls, authenticate user on gathering touch pad and then record user voice and pass back the recoded audio url etc...
Thanks
If you just set the SMS Status Callback URL for an application and nothing else, the isValidApp method insists that other "required" properties be present in the application object, which should not be the case, especially if all you want to do is use Twilio for SMS sending.
This is a design decision. The <Sms> TwiML command doesn't make much sense to implement. You can accomplish the same thing with the Application.sendSms
method.
Clarify the use of TwiML-generating functions and when their use is appropriate
See code in Application.js. When req.body is already populated by the bodyParser() middleware, the signature is not properly calculated.
Thx for this!
I added the following to lib/Client.js:168 after I started getting timeouts and refusals from Twilio. This will keep your app from crashing from uncaught errors.
req.on('error', function(err){
// console.log(err);
})
The fixes in #13 are not available in an NPM package yet. Would it be possible to make a 0.3.2 release?
This should be available in v0.3.0 in a week or two...
Provide the ability to call a callback passed to Application.sendSms
. This provides the user with the "Send status" of an SMS message.
For 'connected' and 'ended' Call events, what are the possible call status values?
I understand that Twilio provides a list of possible call statuses, but I cannot figure out which of those apply to which event.
An official reply from a Twilio representative would be appropriate here or a reference URL to Twilio documentation that clarifies this issue.
When a status callback comes in for that call, it doesn't know who the call is for and throws an error.
2012-04-27T20:51:28+00:00 app[web.1]: Error: Twilio submitted call status for a call that does not exist.
2012-04-27T20:51:28+00:00 app[web.1]: at /app/node_modules/twilio-api/lib/Application.js:297:11
2012-04-27T20:51:28+00:00 app[web.1]: at HTTPParser.onMessageComplete (http.js:137:23)
2012-04-27T20:51:28+00:00 app[web.1]: at IncomingMessage.emit (events.js:64:17)
2012-04-27T20:51:28+00:00 app[web.1]: at Socket.ondata (http.js:1410:22)
2012-04-27T20:51:28+00:00 app[web.1]: at afterBodyParser (/app/node_modules/twilio-api/lib/Application.js:181:6)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.