Sonos API sends too short auth code in return? - api

Turning to all you smart people out there for help, tips and trix :)
I want to connect my NodeRed instance to the Sonos API to control my speakers in various ways. During the OAUTH process however, after logging in with my username and password for my account, the auth code being sent back to me through my redirect_uri seems to be too short? In the developers' guide the example auth code looks like this:
f10072fa6-2134-4fe1-93fd-ca5b9cffa738
where in my case, I just receive the first part up until the first dash sign. Eg.:f10072fa6
At first I ran the connection through a NetScaler, then I changed to using a Nginx Reverse Proxy thinking that the Netscaler might have truncated the URL (for some very odd reason), but the result turned out the same..
Ideas anyone?

The Authorization code you received is correct. The Authorization code format was recently changed and the documentation needs to be updated to reflect this. This question was also answered in Authorization code has different structure than example code.
Thanks!
-Mark

You can also use nodered-sonos to control your speakers. No need to setup oauth2 and using the cloud based api, if you can also have super fast local control of your speakers.
I'm using a combination of the following tools for total control of the speakers:
MQTT server of your choice in Docker (I'm using emqx)
Sonos2mqtt, my own app to connect sonos to mqtt in docker
Node red with normal mqtt in/out flows.
My Favorite flows:
Join playbar to group if group starts playing
Pause group is playbar leaves group (it leaves if I turn on the TV, that should stop the music)
Play ring sound (on all speakers) if someone presses the doorbell
Announce (text-to-speech) when the backdoor is opened

Related

Voice call connection routing React-Native

I am trying to build an application which works this way: I as a user want to start a call with another user. The way I want the connection be made is by random. So it will connect to one of the many clients out there by random. Also when other clients try to make a call, it should connect to another random client and so on. I want those phone calls be made via application(such as WhatsApp) not as a phone call.
Now, the question is; is Twilio a good approach for this purpose?
If yes can you tell me which of their feature would fit my app the best?
Thanks for any suggestions!
Twilio developer evangelist here.
I can answer that Twilio would be a good approach for you to do this within your own application. I'd recommend using Twilio Video to build this as it allows cross platform communication via audio or video (in your case, you may not need the video, but this will give you the best audio quality).
As an example, my colleague Dominik built a video roulette application. It is the case that the interface was built in JavaScript for the web, but the idea would be the same for a native app. The code for the server side part of the application should give some insight into how to connect random pairings.
It's also possible to integrate Twilio Video with CallKit and Connection Services so that you can make outbound calls to other devices that ring like a real incoming call.

Workaround for SoundCloud and its lack of client ids

my company hosts a lot of audio on SoundCloud. We never had a client id. Now we want to start collecting data but I can't use the SDK without that id which, of course, SoundCloud stopped giving out over a year ago (and has not done anything to offer alternatives). Does anyone have any experience with, or a workaround for, this?
Had roughly the same problem.
You could use your browsers client_id to query the API.
Just navigate to a track page in a Browser, hit F12, open the Networking tab and click play. Look out for requests containing a client_id and copy that.
I did this a while ago (3-4 Months), and they're still working.
Con: You can't access OAuth and private stuff, just public content.

Apple iTunes Connect Analytics: attribution provider and campaign id value passing to the app delegate

The new iTunes connect has analytics features now. You can specify the provider (pid) id and campaign id (cid) in the url. e.g.
https://itunes.apple.com/fr/app/candy-crush-saga/id553834731?mt=8&pid=1234&cid=My_Campaign
Can you pass those values into the app for various purposes?
I could not find anything that points to that, even after checking:
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
ref:
http://www.applift.com/blog/new-era-attribution-analytics.html
Unfortunately these params are not passed into the app. They are only used for iTunes Connect stats.
Here are the two common workarounds:
Using a fingerprint to implement deferred deep link and passing the params through that link (Tapstream can do this).
Using a provider like Tune/MobileAppTracking to match the link using the ID for advertising (IDFA).
I wrote a blog post to explain the details: https://attributionapp.com/blog/lets-solve-ios-attribution-methods/
I will edit this response in the future if Apple changes their API. If you let Apple know what you want to build and why passing in the params is a better policy they might change their minds faster: https://developer.apple.com/contact/
If you'd like to build your own fingerprinting mechanism to handle all of this deep linking like we have at branch.io, I can give you some instructions how! One side note as I read it in the accepted answer comments is that the INSTALL_REFERRER in Google Play is often very slow (> 1s delay) to launch after install, so if you're depending your user experience on this, your users in are in for a bumpy ride.
Here's how we built fingerprinting on iOS:
Configure a server endpoint (something like yoursite.com/redirect) to accomplish two things:
Serve up some client side JS to open your app if installed or fall back to the App Store if not. I listed out this code in this answer
Capture a set of of parameters about the clicking user by reading their user agent, etc. Here's a simple subset that will work well:
OS
OS version
IP address
Device model
When the user opens the app, send back that set of parameters, as read from the app to a new endpoint (something like yoursite.com/completematch).
If there's a match, you can pass back the parameters.
If you want to get savvy, you can drop a cookie on yoursite.com and save the match to the IDFA received from the app. Ideally, you'd only do this if you redirect into the app immediately so you're 100% sure of the match. Then if that same user ever clicks on the link again and installs the app, you don't have to use fingerprinting as you can just use the cookie-IDFA pair. We've got hundreds of millions of these at Branch so fingerprinting is more of a fallback mechanism at this point.

How to get notifications when I reach internet enabled area (wifi circle)?

Presently I'm working on a Windows Phone application that will work in both online and offline mode. So that if the net is available means I need to sync my offline data to the respective server. My requirement is if my app is working and when I reach a wifi-enabled circle (area) I need to get a notification. Otherwise need to race an event.
How can I achieve this? Is there any notification channel present in WP7 to inform about this? If yes please demonstrate some code to achieve the goal.
You can determine if you are connected to a network, you can get the connection type and the phone informs you when it goes on/offline:
NetworkInterface.GetIsNetworkAvailable() checks if you are online or offline
DeviceNetworkInformation tells you more about the network type (Wifi, ...)
NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(OnNetworkChangeHandler); registers a listener to listen for changes
Click here for an example on how to listen for changes. Also very good is this tutorial from MSDN, demonstrating all the goodies mentioned above!
I also recommend reading this blog post as it contains much valuable information about the different APIs.
PS: It is not possible to get a list of all available WLANs around the phone. You can only see the WLAN you are connected to (if). That is a limitation of the Windows Phone API.
The platform does not include support for the "GeoFencing" scenario you describe.
The best solution currently available is to periodically (using a Background Task) check to see if a connection is available and to begin the sync then.

Do any Google Voice APIs still work?

I am interested in writing a simple CLI program that will send an SMS using Google Voice.
There are several scripts and an API or two available, but I have run into an issue that none of them seem to work any longer; as they mostly rely on parsing returned web pages.
Is anyone familiar with a current API that works so that I can send an SMS on Google Voice?
Thanks!
Looks like Google Voice changed the login procedure, and it now expects you to pass back a cookie. This issue for the Python wrapper sums it up: http://code.google.com/p/pygooglevoice/issues/detail?id=60
UPDATE AND FIX: Actually all that needs to happen is to change the login URL in your code:
Old URL - https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral
New URL - https://accounts.google.com/ServiceLogin?service=grandcentral