Twilio Send Message Method for Windows Phone 7.5 - windows-phone-7

How do I fill in the send message method for Twilio, I know how to fill in the from, to and body. the only part that befuddles me is the System.Action. Please help.

System.Action is basicly a method.
You can call SendSmsMessage this way:
Twilio.TwilioRestClient.SendSmsMessage("from", "to", "message", (smsmessage) => { });
I'm not familiar with Twilio or the SendSmsMessage method, but I suspect, that this method gets called when SendSmsMessage finishes or something like that. In this case, smsmessage is a parameter that is usable in the Action.
You can read more about System.Action here and about c# lamdas in general here

Related

I don't understand the Twilio URL Parameter on Voice

I understand the purpose of this for more complex functionality, but I'm trying to make a simple app that does nothing more than forwards to a phone number. I don't want to hard code the forward via a Twimlet because I want to build a web app that dynamically allows me to assign the numbers. Can someone tell me what I'd put for URL parameter in this situation?
get '/forward-call' do
#client = Twilio::REST::Client.new
#call = #client.account.calls.create(
{:to => "+15127778888",
:from => "+15122222222",
:url => "What in the foo should I put here?"})
end
Twilio developer evangelist here.
Does your /forward-call endpoint get called when someone makes a call to your Twilio number?
If so, you don't want to be calling the REST API right now, you want to respond to the webhook with some TwiML. In your case, you'd want something like this:
get '/forward-call' do
content_type 'text/xml'
"<Response>
<Dial><Number>#{NUMBER_TO_FORWARD_TO}</Number></Dial>
</Response>"
end
Does that help at all? Let me know if I can help out any more at all.

How, in Node.js, to respond to a GET request from client (send some HTML in response)?

I have a Node.js app which, among other things, responds to a AJAX (jQuery) $.get() request from a Web page by sending some HTML back to that page. The app uses Express.
So in the server code, I have:
app.get('/friends', api.friends);, where api is defined as api = require('./static/routes/api') and i'm setting app.use(app.router);.
In myapi.js module, I have api.friends code: I have
exports.friends = function(request, response)
{
...lots of code...
};
wherein I create some specific HTML.
Now, my question is: How do I actually send this HTML back to the client? I can't use the passed-in response object because this is no longer an Express-type response object, so the usual reponse.send(), .end(), etc. methods don't exist.
I have no idea what to do, reflecting a lack of understanding of Node and its innards (this is my first Node app), so any and all help will be greatly appreciated and welcomed. Thank you.
As #Daniel stated in his comment, the response object is certainly an Express object, and you can return your HTML simply by rendering a view, like so:
exports.friends = function(request, response) {
//do stuff
response.render('friends.html');
};
Of course, you would have to define your views in your app.js setup, with something like this:
app.set('views', __dirname + '/views')
Ugh! I am such an idiot! In my exports.friends handler, there's a request going out which, as a part of its calling parameters, takes a function of the form function(error, response, body). Note the response parameter. I was sending the results within this function, which of course used this response object and not the one passed through exports.friends(request, response). Doh. Oh well - thank you anyway - you made me look at the code again, and with the persepctive of knowing that the response object was legitimate, I was able to see the error. Thank you again - appreciated!

How to get notified when SMS Status changes from 'Queued' to 'Sent'?

Hello,
I am trying to learn Twilio API.
When I [send SMS through php][1] script.. twilio returns a response object with status = 'queued'. Now I want to get notified when the status changes to 'sent'. Is this possible with Twilio??? and if yes then could any body advise me on how to implement his.
And how to add 'StatusCallback' url
$sms = $client->account->sms_messages->create(
// the number we are sending from, must be a valid Twilio number
"000-000-0000",
// the number we are sending to - Any phone number
"0000000000",
// the sms body
"Hey Friend, Monkey Party at 6PM. Bring Bananas!"
);
You're on the right track looking to the StatusCallback. When using the Twilio PHP Library any optional parameters can be set using an array as the last argument.
<?php
$sms = $client->account->sms_messages->create(
"1235551234",
"1235554321",
"Hey Friend, Monkey Party at 6PM. Bring Bananas!",
array('StatusCallback' => 'http://example.com/sms/status.php')
);
When the message is sent (or if it fails) the data will be passed to the StatusCallback url.

How do I parse a POST to my Rails 3.1 server manually?

Scenario:
I have a Board model in my Rails server side, and an Android device is trying to post some content to a specific board via a POST. Finally, the server needs to send back a response to the Android device.
How do I parse the POST manually (or do I need to)? I am not sure how to handle this kind of external request. I looked into Metal, Middleware, HttpParty; but none of them seems to fit what I am trying to do. The reason I want to parse it manually is because some of the information I want will not be part of the parameters.
Does anyone know a way to approach this problem?
I am also thinking about using SSL later on, how might this affect the problem?
Thank you in advance!! :)
I was trying to make a cross-domain request from ie9 to my rails app, and I needed to parse the body of a POST manually because ie9's XDR object restricts the contentType that we can send to text/plain, rather than application/x-www-urlencoded (see this post). Originally I had just been using the params hash provided by the controller, but once I restricted the contentType and dataType in my ajax request, that hash no longer contained the right information.
Following the URL in the comment above (link), I learned the how to recover that information. The author mentions that in a rails controller we always have access to a request variable that gives us an instance of the ActionDispatch::Request object. I tried to use request.query_string to get at the request body, but that just returned an empty string. A bit of snooping in the API, though, uncovered the raw_post method. That method returned exactly what I needed!
To "parse it manually" you could iterate over the string returned by request.raw_post and do whatever you want, but I don't recommend it. I used Rack::Utils.parse_nested_query, as suggested in Arthur Gunn's answer to this question, to parse the raw_post into a hash. Once it is in hash form, you can shove whatever else you need in there, and then merge it with the params hash. Doing this meant I didn't have to change much else in my controller!
params.merge!(Rack::Utils.parse_nested_query(request.raw_post))
Hope that helps someone!
Not sure exactly what you mean by "manually", posts are normally handled by the "create" or "update" methods in the controller. Check out the controller for your Board model, and you can add code to the appropriate method. You can access the params with the params hash.
You should be more specific about what you are trying to do. :)

get process(e.g. TextEdit) as an object in cocoa

I am a newbie and i want to get a process or a key window as an object as i need to send message to it.In fact , i need to get them so that i can manipulate them with my input method kid(IMKit).
The corresponding method is:
-(BOOL)inputText:key:modifiers:client:
I want the key window/process receive the event as client.
I am appreciated if anyone can help.
i want to get a process or a key window as an object as i need to send message to it. … the corresponding method is
-(BOOL)inputText:key:modifiers:client:
You have it the wrong way around. As noted in the documentation, that method is one that you implement, in your input method. Your input method does not send that message; it receives it. And all you do in that method is accept or veto the input.
I think you need to post a higher-level question about whatever it is you're trying to do, asking how to do it.

Resources