What Request URL for Voice in TwiML App setup should I use when I develop on localhost? - asp.net-mvc

I am creating an app in ASP.NET-MVC where I can call phone number from browser.
To do that I need to create capability token like in the sample:
var capability = new TwilioCapability(accountSid, authToken);
capability.AllowClientOutgoing(appSid);
capability.AllowClientIncoming("jenny");
string token = capability.GenerateToken();
The appSid is an identifier of TwimlApp created on my Twilio account as described here: https://www.twilio.com/help/faq/twilio-client/how-do-i-create-a-twiml-app
I have absolutely no idea what should I put in the Request URL in Voice section. I develop on locally on my computer. ASP.NET-MVC app is run on localhost.
Sample image from Twilio's website:

Developing with a web service like Twilio can be difficult when it needs to make requests from a server to your development environment. One of the best tools I've found to make this easy is called ngrok.
ngrok allows you to create tunnels to your machine and give them a friendly name with a custom port.
For example, you could setup ngrok locally on your machine to forward all requests from twilio to yoda.ngrok.com to your environment. This makes it really easy to develop locally with web hooks. Let me know if you have any questions on getting setup!

Related

Testing twilio webhooks in dev environment

I have a web app in production using Twilio which makes use of the programmable video API and various webhook call backs. When certain events happen, Twilio lets my API know via the webhook so the appropriate actions are then triggered.
From what I can tell, there is no development (ie: sandbox) environment for Twilio. This is very strange. I would expect there to be a sandbox environment so that we can do complete local development without needing to create fake responses from Twilio for webhooks and the likes.
It appears that Twilio's recommendation is to use ngrok or similar for development. But this is not possible when you already have a production application running and Twilio has no sandbox. I can't simply change my webhook endpoint in my Twilio account to point to my local ngrok end point. That would mean that my production end point is not live during that time.
The other suggestion by Twilio is that we create fake responses which we expect to receive by using curl or similar. This seems incredibly impractical having to trigger fake responses at dozens of different points in time throughout the flow of an app rather than simply receiving them from a sandbox/dev environment with Twilio.
What is the recommended method to do local Twilio related development which incorporates webhook callbacks when you already have a production app running?
I'm not familiar with Twillio specifically but generally speaking, you can add multiple webhook URLs. The idea would be to have one URL pointing to your production server and another pointing to the Ngrok endpoint.
Alternatively, you could use https://hookdeck.io (disclaimer: I'm the founder) to send the same webhook to multiple URLs. We call this webhook fan-out, you could set up both your production URL and Ngrok as destinations and provide a single endpoint (provided by Hookdeck) to Twilio.
It would look something like this:

Twilio calls integration to ios app without server app

This must be a silly question, but is there any way to make calls btw two iOS apps without server app mentioned in Twilio tutorials. Tell me please what server app does and is there any way to perform such tasks on front end instead?
Twilio developer evangelist here.
The server is required to generate an access token for your users to get access to the Twilio service.
You also need to host some TwiML to tell Twilio what to do with calls when you make them.
If you are not interested in running a server, however, you are in luck. Just recently, Twilio launched Functions, a serverless environment for you to deploy code to. With a Twilio Function, you can use Node.js to generate your access tokens for your users and you won't have to host the code yourself, it will all be on the Twilio platform.
Check out Twilio Functions in your console and take a look at the Node.js quickstart application for the iOS Twilio Programmable Voice SDK which should give you an idea of how to use Node for your application within Functions. I'm sure there'll be tutorials and blog posts coming out. Also, check out this video on how to create access tokens for your apps with Twilio Functions.
Let me know if that helps at all.

callbackurl while connecting to vso using oAuth

I am trying to connect to VSO using oAuth.
First step is to register our app and configure a call back url.
I am creating a console application to test the connectivity.
Please let me know how to configure the callback url.
Firstly, please take note that: Right now, it is only supported to register web application, it is impossible to register a console app.
So, you need to have a web app first, you can download and use this sample project for a quick start: https://vsooauthclientsample.codeplex.com/
After you download the app, open it in VS2013 or higher, right-click it in Solution Explorer and select Publish.
On the Publish Web page, select Microsoft Azure Website option to publish that web app to Azure.
Then, the web app is published to Azure with the URL similar to: https://vsodevabc.azurewebsites.net
And when you register this web app, you can set Application Website and Callback URL to be the followings. (note: the callback URL should be https://yoursite.azurewebsites.net/oauth/callback, where "yoursite" is the name of your Azure web site)
When using VSO (now called Team Services) with oAuth2.0 you do have to provide callback url endpoint that Microsoft's Team Services can call directly. So you need to have your application's callback url endpoint published such as publishing to Azure or Aws or any hosting provider that will allow you to have publically accessible url. In the FAQ under Team Services Rest API, there is mention of this approach for debugging purposes:
Visual Studio Team Services does not allow localhost to be the hostname in your callback URL. You can edit the hosts file on your local computer to map a hostname to 127.0.0.1. Then use this hostname when you register your app. Or, you can deploy your app when testing to a Microsoft Azure website to be able to debug and use HTTPS for the callback URL
Visual Studio Team Service's Rest API oAuth

Using OAuth for both development and production environments

I have seen other questions on SO about this (here, here, and here), but I am not satisfied with any of the solutions, so I am asking it again. I am starting a web application that will utilize OAuth from multiple providers (Google, Facebook, Twitter, Yahoo) for authentication. I am struggling to find a configuration suitable to use for both a local development environment and a production environment.
The leading solutions I've found are to register multiple apps within each provider, receiving a different consumer key and secret for each:
"My App Production" - with a callback URI to http://www.myapp.com/callback
"My App Development" - with a callback URI to http://local.myapp.com/callback
Add an entry to your local hosts file to point local.myapp.com to 127.0.0.1 and some configuration for your application to use the proper consumer keys based on the environment, and you are good to go, right?
But my application is responsive and I need to test my development environment running on my PC from multiple other devices, like my iPhone and iPad, neither of which will be able to resolve the development callback URI.
Let's say I already have a DNS server on my network and am able to add the entry for local.myapp.com there instead of my local hosts file and can now access my development instance from any device on the network.
But my development team all operates on the same local network. Now local.myapp.com points to the same IP for everyone. Let's go back to setting the hosts file on each developer's computer so that they can all work independently from within their workstation. Now no one can test their development instance from their iPhone again. It hardly seems like the right answer for each developer to register an application with the provider just so they can specify a unique callback URI.
Normally when I get way down in the weeds with a complicated solution for a seemingly straightforward issue, it usually means I'm doing something fundamentally wrong. Am I missing something about OAuth, is it not intended to be used like this? I am tempted to scrap OAuth altogether and just go with OpenID (no app registration required and can specify the callback URI from within the app), but then I lose two of the big hitters in Facebook and Twitter. I don't really need any of the user's data, it's just a nice to have if it's available. Can someone talk me back into OAuth?
I can't speak for FB or Twitter, but in Google's Oauth implementation you can register several oauth callback URLs. So you simply need some logic in your app which senses that it is in test mode, and then starts the Oauth flow with the appropriate callback URL. There are downsides, eg clashes between the live and the test refresh tokens, but they are manageable.
In my app I have a singleton which manages all of this. When my app needs to start an Oauth flow it calls the singleton with the request URL and any other salient data (eg. debug flag) and the singleton returns the correct callback URL, client ID etc.
I posted the following answer about a rails app I wrote:
OAuth2 in development and production
It was a gem called figaro which did per env configs for google OAuth2.
I have yet to find a less manual approach that enables dev access to all concerned devices:
Assign each developer's machine a fixed IP through the local network's DHCP system based on their MAC address, or (less recommended) have them choose an IP and hope for the best
(optional*) Assign each developer's machine a DNS hostname in the local network based on that IP
Register an oauth entry for developer on each provider with the hostname of the developer's machine.
Each developer configures their application to use their unique oauth dev tokens.
Assuming all the devices in the network rely on the same DHCP and DNS servers you'll then be able to visit alice.dev.myapp.com or bob.dev.myapp.com from any device on the network.
Note, you'd manage the oauth configuration for each an every other environment separately, but following the same approach.
There are likely tools to automate registering a developer's machine IP and hostname to ease that part of the puzzle. Registering the oauth config on each provider per dev is the most tedious step.
UPDATE
*You can skip the DNS part if you use a xip.io url e.g. 10.0.0.123.xip.io if you know Alice is 10.0.0.123, but you'd still want that IP to be fixed as you don't want to keep updating the url for the oauth tokens in step 4.

Rails, QBOE, qbXML and integrating them all together

I am currently developing a Ruby/Rails app that will be used in-house as a sort of Enterprise application to support our business.
Our company uses Quickbooks Online to do almost all of our accounting, most importantly for invoicing.
I am looking for a way to automatically generate invoices from our Rails app into Quickbooks, as well as be able to pull customer balances and some other "basic" information into the Rails app to display on a customer information screen.
I have done a lot of research on the topic, and have yet to find an acceptable solution to what we're trying to accomplish.
Quickbooks Web Connector - Not applicable since are not running Quickbooks Pro
Intuit Anywhere app - The app we are using is certainly not a SaaS App, as it is specifically designed for our business, and the only Quickbooks file/account it will ever see is our own
Quickbooks Online/qbXML Gateway application - This seems to be the best fit
So I have spent considerable time with Keith Palmer's Consolibytes wiki, and Intuit's Official Documentation (which is great to get started, but doesn't really provide much help for the details), and have been unable to even link my application to quickbooks using the https://qbo.intuit.com/redir/addsdkapp?appid=YOUR-ID-HERE&appreferer=&appdata=1 link.
My server does have a GoDaddy generated SSL certificate, and I have visited the connection callback URL and have confirmed that everything is in working order there. However, I keep getting a "Failed to notify third party application about this connection" error. There is no evidence of a request from QB to my server in any of my logs.
So what I'm getting at here is this:
Is what I'm trying to do possible and/or practical?
Am I going the right way about it?
I'd really love to find someone out there who has done something like this before and maybe shed some light on the whole process.
Thanks!
So what I'm getting at here is this: Is what I'm trying to do possible and/or practical?
Yes.
Am I going the right way about it?
Almost. :-)
From what you posted:
My server does have a GoDaddy generated SSL certificate, and I have visited the connection callback URL and have confirmed that everything is in working order there.
It sounds like you registered in HOSTED mode.
Unfortunately, the Intuit servers don't consider GoDaddy certificates valid, and thus won't be able to HTTP POST your connection ticket to those servers. That's why you're seeing this:
Failed to notify third party application about this connection
Additionally, I believe they do reverse DNS checks, which will most likely fail because GoDaddy generally doesn't set up rDNS entries.
The solution is:
Do not register in HOSTED mode
Instead, register in DESKTOP mode.
Once you've registered, use this URL to register get your connection ticket:
https://login.quickbooks.com/j/qbn/sdkapp/confirm?appid=YOUR-APPLICATION-ID-HERE&serviceid=2004&appdata=1
(make sure to plug your actual application ID into the URL)
Instead of Intuit HTTP POSTing the connection ticket to you, the connection ticket will be displayed and you can copy/paste it. From there on in, it's as simple as HTTP POSTing additional HTTP requests to Intuit's servers.
Sample XML requests can be found on our QuickBooks integration wiki - make sure you use the DESKTOP mode examples.
Hope that helps clear things up!

Resources