One signal - create segment to push to recent location - google-cloud-messaging

I would like to, via OneSignal REST API :
filter the push to users in a certain location (as in the doc) but it lacks sample code/relevant routes. The steps would be :
store tags for users (documented here, this is fine)
creating a segment (I don't see this in the docs)
push by filtering by segment (this is covered here)
Similarly I would like to be able to filter the push to users that visited a location in a certain date range (ex. last week, last month...). I am not completely sure this is possible using only OneSignal.
The minimum I would need is how to create a segment with OneSignal.
Edit : looks like there is a way in the dashboard, but I need to do it programmatically.

(I help work on OneSignal) OneSignal does not support programmatically targeting by a location at this time but we're planning on adding support for this in the near future.
One way to do some of this until then would be to provide the name or position of a location as tags. For instance you could use the tags lat=41.123, lon=55.331, then target users programmatically where the tags are greater than and less than the ranges you specify.
OneSignal does not provide built-in functionality to target by historical locations and we do not plan to add support for this, but you may be able to use tags to achieve your desired result.
Note that OneSignal does allow you to target by Player ID, so you could always store your users' Player IDs in your own system and do the calculation of who should receive a notification on your own.

Related

Microsoft Graph API List Locations

Hi I am having trouble finding any way to list locations so I can create an event and add a location to it.
There is a list of known locations that should be available shouldn't there be?
https://graph.microsoft.io/en-us/docs/api-reference/v1.0/resources/location
I'm not sure that listing known locations is available, so we'll need to be creative on this one.
You could get a list of existing calendar events and only select the locations property (what you linked to). If you then filter these client side to remove duplicates, you can get a decent list of known locations. The down side is that if a room is now available but has never been used, it won't appear in this list. Also, this is only for one user so another idea is querying a different (or multiple) calendars. For me, the following snippet returns around 247 unique locations.
https://graph.microsoft.com/v1.0/me/events?$select=location&$top=500
With the Graph JavaScript SDK this looks like:
client
.api('/me/events')
.select('location')
.top(500)
.get((err, res) => {
var locations = res.value
.map((x) => x.location.displayName) //only get the displayName
.filter((v, i, a) => a.indexOf(v) === i) // remove duplicates
});
There's also some existing threads about listing conference rooms.
So We decided not to use the graph API at all. It is not ready I actually cannot believe this is an oversight on Microsoft's part. Any organization's core problem when it gets to SME size is booking a room. We opted to use the Office 365 SDK,ADAL and Outlook and use a convoluted way to solve the problem that involves either checking the calendar or checking your inbox for the room being booked or not. Then we opted to figure out whether the room was busy or not using the preview availability Api.

How do make an external API call from a Podio App field?

I have a location field called origin and a field called distination. I am trying to calculate a third field called distance by using an address from both the Origin and the Destination field? What is the easiest way to achieve this?
Here's one idea. Use the Google map's destination API to get the distance between between the 2 location fields. I am not sure how I can make these 2 API calls.
Sorry, but I don't think that's currently possible within Podio. I tried to get this to work using Podio's Calculation field and Google's Distance Matrix service. Unfortunately, the Calculation field doesn't allow access to the XMLHttpRequest API, which is what you would likely need to access any 3rd-Party APIs.
You need to use a third party tool to calculate the distance. Then update a number field (or maybe text field depending on your need) in Podio with the result. The calculation field cannot be use for such purposes.

API key for themoviedb.org

I need to use themoviedb.org for one of the apps I am working on. For using the API, I need an API key. How do I get an API key on themoviedb.org?
I found this in the forum:
You can request an API key by clicking on the "API" link from within your account page on the left hand sidebar. See here
In terms of making things faster for people, the URL for application is here these days (Under Account>Settings>API as previously mentioned): https://www.themoviedb.org/settings/api
You'll want to start with a Developer key as wait time for a Developer key is zero (immediate). A commercial key, as far as I understand it, is only appropriate once the app is developed and running. Turnaround for a commercial API key is about 3 days-ish though obviously could vary.
Once you have a key, inside the doco pages there's a "Try It Out" tab which lets you do calls. The normal code flow (for getting movie details) would be something like:
Get Configuration (needed for image paths, should be cached)
Search Movies (returns a list, find the numeric id for the one you want in the list returned). Be aware there might be duplicates returned - you can use the year of release, title and language to find the one you want.
Get Movie Details with the movie numeric ID, with "append_to_response" of "credits,images,trailers" so that actors, writers, directors, and trailers (aka videos) are returned.
Check doco for how to find the actual image paths, using configuration values fetched above. It's generally considered courteous to copy the images you want to use to your own server rather than serving them from TMDB's server.

DISQUS: Is it possible to get a particular user's posts in a given forum?

I am running a website, whose community is powered by Disqus. I would like to create user profile pages, where the page would display the particular user's most recent activity, but only for my particular site (forum, in Disqus' terminology).
I ran through the entire API documentation, but I could not find a way that would allow me to filter by both user, and forum. I would be able to grab either the entire list of posts for a given forum, or the one from a particular user.
In every API call, there is a mysterious query paramater, where I tried to plug a series of filters, but none of them worked.
Is there something that I could be missing?
It's not that obvious, but you can use the query param as a filter for users. Try something like this:
https://disqus.com/api/3.0/forums/listPosts.json?forum={SHORTNAME}&query=user:{USERNAME}&api_key={YOUR_API_KEY}

Using the Rally API to re-rank multiple stories

I'd been looking at using the Rally API to create an app to do some simple auto-ranking stories based on specific criteria (at the request of / to help out a couple of our Product Owners) in a drag&drop workspace.
I did this by adjusting the "Rank" properties of the sequence of stories (I made sure to keep the rank values within the same overall min / max range as prior to the auto-reorder). I made a call to the API to update each story's rank individually (in quick succession).
Testing the app, I found that sometimes after running the auto-ranking app, some screens (such as the kanban board) would tell me that "drag and drop re-ranking is disabled for manual rank workspaces" (and the kanban would no longer let me drag & drop, although other screens such as the backlog would still let me drag & drop, and the workspace settings were still set to drag & drop). Deleting the stories, or reordering them on the backlog screen would return things back to normal.
After trying a few ideas to solve this, I figured perhaps if I was updating the Rank on a number of stories in quick succession, the back-end might be getting confused with these (potentially several / concurrent) requests. Introducing a delay between each story's API call has seemed to avoid the problem, and to speed things up, I now update a story's rank in the API only after the previous story's rank update has invoked the "updateComplete" function.
Do the assumptions in the last paragraph above make sense based on the backend ranking? Is there any Javascript API call to update multiple stories at once? (Otherwise I'm quite happy with the solution of only calling the API "update rank" after the prior API "rank update" call has returned ok).
That sounds like you discovered a possible issue with the backend ranking. The warning you were getting stems from the board trying to figure out which type of workspace you are in (manual or dnd rank). Since that setting is not currently available via WSAPI the board tries to figure it out based on its data and sometimes gets it wrong.
Currently there is no fully supported/documented way to adjust the ranks of items via WSAPI. The Card Board component in the App SDK uses special rankAbove and rankBelow query string parameters during update calls (which you can see in Firebug or the Chrome dev tools).
How are you currently setting the Rank values?