How to handle tags and segments in phonegap - phonegap-plugins

Im making a dashboard for my users (in app) where they can subscribe to different segments, and would just check if I understood this somewhat right.
I make segments in onesignal.com dashboard, and in one segment i make a key = "value" (e.g test)
I send a push from my server and include
"tag" => "test",
Application can now use sendTag in an event (like a button user presses), and "subscribe" to that tag in app.
Is it more or less how this system works. I really have a hard time reading it out of the docs.

You have this all correct, if you choose you can also use the tags field on the OneSignal create notification REST API POST call instead creating segments on the dashboard first.

Related

Spring Data Rest Frontend deep linking

So i have been struggling with this one question some time now:
How to handle details Page or deep linking on the Frontend.
So, say, we got a paged collection endpoint with user entities in it and a React App consuming the endpoint.
The flow would be, user authenticates, gets collections, clicks on an item and is either:
Redirected to a new Url say: webapp.com/users/userid
A modal opens with the user details.
Say we got a scenario were two people working with the webapp, Person 1 wants to share a link with Person 2. Person 2 should do some updates on a specific user, which is identified by the link.
The link should be something like : https://www.webapp.com/users/{slug or id}
With Option 2 this functionality is not mappable.
With Option 1 we got to expose the ids in the response to identify the resource, which may work, but we would still need to hardcode the url, as the findById method is not exported as a Uri Template.
So, my Solution would be to add a slug for the resources, implement a search method by the slug, and then get the user, if found, by its self-link.
Sounds like a good solution for me, but on the other hand, I would have to add an extra frontend id(the slug here) which would need to be also unique, to the database model.
So how do you guys handle a problem like this, or is there anybody using spring data rest in this way or in production mode where you have the handle situations like this?
Should mention that this isn’t a primary problem with spring data rest but rather with hateoas itself.
thanks in advance
Florian
You don't need to hardcode URL template. Spring data rest will generate links for each resource.
You can refer to it from front end by some format like: {your_user_object}._links.self.href

ExpressJs route redirect

I have a widget for user to get information regarding books. The UX of the widget changes according to the fact that the user is logged in or not. Now I have a route for logged-in user(say, /user/getBookInfo) to get the book information(which includes sending sms n email logic). For users who are not logged-in I have created a different route(say, /public/getBookInfo), which includes some additional processing too. However retrieving the book information, sms and email logic etc is already present in '/user/getBookInfo'. I don't want to duplicate this function.
One option is call res.redirect('/user/getBookInfo') from /public/getBookInfo . However I want to avoid the redirect in this way.
So My question is How can I reuse this logic in /public/getBookInfo without using redirect??
Probably the best way in a Node.js application is to make a separate module, and put the common logic there. Then you can require the module in both routing files.

How to grab user track info through spotify api

I recently just got through the beginning tutorial for creating a web app with the spotify api. https://developer.spotify.com/web-api/tutorial/. The tutorial was great for showing how to authenticate a user with oauth and log in a user.
The problem I am having is with the endpoint. I can't seem to figure out how to change the endpoint so that instead of displaying a users profile, I can see a list of a users track, better yet starred or top 10 tracks.
for a 10,000 view perspective of what I want to build is a app that would allow users to easily log in through their spotify account, take their stared or top tracks and push them to a radio that I am building with an raspberry pi.
I am new to working with the spotify api and working with api's in general so whatever advice would be awesome.
At the moment, there is no way to get the "starred"-playlist. (At least it's not documented)
I don't know what you mean with "Top 10 User tracks", since this doesn't exist as far as I know
To get a list of the account's current playlists, change the URL to:
https://api.spotify.com/v1/users/{user_id}/playlists
With this URL, you will get a list of simple-playlist-objects wrapped inside a paging-object. Now you can select one of the playlists (or loop through them) and fetch its track this way
NOTE:
If you also want to fetch private playlists, make sure you use the scope playlist_read_private

No source parameter in real-time response from API checkin

I have an app that
- initiates checkins via the API
- receives checkin data via the push mechanism
The JSON object returned by an API call contains a source parameter denoting the app. [This actually seems unnecessary, since my app is initiating the API call...]
The corresponding real-time push response sent to my app does NOT have the source parameter included. Why is that?
I'm attempting to filter out the push data related to my app's checkins, and the easiest way would be to inspect source parameter. [I could also inspect the checkin ids, and watch for duplicates in the two paths; but that seems unnecessary if the source parameter was always included.]
Unfortunately, that particular field isn't currently passed along in our Push API. What exactly are you trying to do?
If you're looking to get real-time notifications about your own app's check-ins, it seems like you don't really need foursquare's push API? You could just have your app send-up the info you want to your own servers at the same time (or immediately after) you check in the user on foursquare, so that you still get real-time info.
If that doesn't work for you, if the user has authorized your application (which will be the case if you're using the User Push API), you can query our check-in detail endpoint (https://developer.foursquare.com/docs/checkins/checkins) to get that info, and filter away the check-ins you're not interested in.

Zabbix web scenarios - how to include the content of the web response in notifications?

I have notifications coming back from web scenarios that say "PROBLEM' and "OK". I would like to include the content of the web response when a problem happens. I'm not worrying about header values, just the content of the web page. Is this a variable I can reference in the Notification setup?
Unfortunately zabbix doesn't store that data (the database would get rather huge). One thing you could do is add a media type script, which you send your alert to (instead of standard email). Then in that script you could parse the item that is triggering and do a separate curl on the webpage. Ugly and error-prone, but as good as it gets for now.

Resources