Should one be able to register the same device multiple times without getting a canoncial id on the "duplicate" registrations? - google-cloud-messaging

I'v implemented the GCM, but have some points it seems I didn't follow understand.
GCM have a concept of Canonical Ids, in which if the client registers two or more times, and you from the server sends messages to these Google will return a (the) canonical id of the last registered regId ?? When I test this by deliberately not unregister the device it still successfully sends multiple messages to the same device. Have I misunderstood what the canonical id is? Are you suppose to be able to register the device several times ?

Yes you can register the same app/device multiple times, and canonical Ids are designed to help you fix that problem when it arrives. Your server will need to prune your registration ID list when you receive a response with a canonical Id. You can see a response I wrote here: android GCM get original id of canonical id That describes the format and what to do.
This post also contains good information about canonical Ids: GCM and id handling

Related

Can I use a Slack bot to count how many times each user has posted a message in multiple channels without joining those channels?

I want to use the Slack API to aggregate how many times each user in Slack has posted a message in a specific period of time. The conditions are as follows.
Multiple channels are covered
Both public and private channels are covered
So here's what I'd like to ask you;
I've read the official Slack API documentation, and apparently there are no direct API methods suitable for the above kind of aggregation, is that correct?
If the above is correct, I think the only way is to parse the text from the text property, which is the return value of the conversation.history method, and aggregate it, is that correct?
Unfortunately, there is no out-of-the-box method that will enable you to get that exact data. A bot needs to be in a channel if it's going to call conversations.history. You'd need to identify the id of the user[s] and filter through the response payload to get the aggregate number of messages for that user. However, moving forward you can use the Events API with the [messages][2] event type. This way your app will be notified of all messages in a channel in real time.

Sonos player not calling getExtendedMetadata after rating item

I am implementing two-button rating for tracks. When the user clicks vote up/down, rateItem gets called, and my server returns an empty rateItemResponse (I have defined AutoSkip and OnSuccessMessageId in the presentation map). Immediately afterwards, getLastUpdate is called, and my server returns a response with the favorites value incremented. However, after the getLastUpdate response is returned, getExtendedMetadata is not called on the rated track to get the new user rating. What is the specific setup in order for getExtendedMetadata to be called after seeing an updated favorites value?
There are a few things you need to do to get this going, not all of which you mention in your queston. So, in case you haven't done this already, run the test as described here: https://musicpartners.sonos.com/node/376
Specifically note this section on that page:
There is another test, test_meta_data, in the ratings fixture that verifies that both getExtendedMetadata and getMediaMetadata are implemented correctly. This means that when these SMAPI requests are made with the object ID's listed in the Self-Test config for Test Track and the responses should contain a dynamic tag as part of the mediaMetadata. Inside the dynamic tag you must set property tags, each of which should contain a name and a value which is mapped to in the presentation map.
Also, maybe Sonos doesn't call extendedMetadata because there were no dynamic or property tags (or something) in the initial call's answer (but still the getLastUpdate call is supposted handle that, I think).
EDIT:
This seems to me to be a bug in the sonos customsd system. It should send a getLastUpdate request after a rateItem response, but it doesn't. I expect that this is a known bug, but since I cannot find any SMAPI bug reports sites monitored by Sonos, I am not sure. At any rate, if you are planning to submit you music service to Sonos, they will test it and let you know whether this is also a problem in production.
Any Sonos employees that can shed light on this? (Since the move to Stackoverflow, it seems nearly impossible to contact anybody from Sonos....)

Social Tables data model

I've just started looking at the documentation as we are going to need to integrate Salesforce with Social Tables shortly, so I am really new to Social Tables.
Specifically, we will need to sync data between the CRM and Social Tables Events and Guests, and maybe other objects, so it would be very helpful to have a data model or similar to check the relationships and fields available in Social Tables architecture.
I haven't found anything in the documentation, is there any way to get this, even if it's at a high level?
Thanks
Danny
To make an integration with SocialTables you'll have to do a few manual steps, there is no way to do this completely programmatic from my experience. You'll also have to be prepared to contact SocialTables to get get correct guestlist ids. Also keep in mind that the API documentation isn't always correct, the API logic is also quite difficult to understand from time to time.
The first thing you need to do is figure out which version of the Venue Mapper you use. You'd want to use the 4.0 api and as far as I know this version of the api is only supported by Venue Mapper 3.0. I believe the Venue Mapper 3.0 is the frontend tool SocialTables provides to do the venue planning.
In social tables an event has two ids, one numerical one and one alpha-numerical one, when you use the 4.0/events endpoint you only get the alpha-numerical event id, and your going to need the numerical one. The only way I've been able to get the numerical id is to pull it out from the url when using the Venue Mapper, example of the url follows below:
https://plan.socialtables.com/team/{team_id}/event/{event_id}/space/{space_id}
Now you need to get the guestlist id, you can get that by using the following url, using the numerical event id:
GET https://api.socialtables.com/4.0/diagrams?event={numerical_event_id}
This endpoint return a json structure where one of the parameters is "guestlist_id".
Please be aware that the guestlist id you get from this endpoint might not be the correct one. I struggled quite a bit with this part and ended up with SocialTables sending me the guestlist id by email.
To get the guests in your guestlist use the following api endpoint:
GET https://api.socialtables.com/4.0/guestlists/{guestlist_id}
The {guestlist_id} is an alpha-numerical string similar to: cfdac1c0-yb1d-12e6-84a5-a39e92131645
And by that you should hopefully get access to your guests.
Hey thanks for using our API.
To answer your question, the best way to see the data model at the moment is to access our developer portal and use the API console to see what is returned. For events you will need to know the team id of the team you are working with use the team events endpoint to get access to the event ids.
https://developer.socialtables.com/api-console#!/Events/get_4_0_legacyvm3_teams_team_events
This will return some basic information about each event for that team. You can then request additional details for specific events by using this endpoint:
https://developer.socialtables.com/api-console#!/Events/get_4_0_legacyvm3_events_event

How can I deep link into QuickBooks Online with results from API calls that don't include the txnId

QuickBooks Online (QBO) uses a URL format like qbo.intuit.com/app/timeactivity?txnId=123 to point to, in this example, a TimeActivity.
However, in the API, resources are referenced by entityId (returned as just Id when querying via the TimeActivity API), which is different from txnId.
In my time tracking web app, I have a feature that exports time to QBO as TimeActivities. I'd like to provide users with direct links from the time entered in my app to the corresponding TimeActivity in QBO—is there any way to do so?
The answer to this is that it's not currently possible because there's multiple base URLs (I think they call them "realms") in use for QuickBooks Online (qbo.intuit.com is only one of them). Because you do not receive this information as part of linking to QBO via OAuth, there's unfortunately no way to construct proper links.
Yes, when creating a successful TimeActivity you will receive back an Id, which I assume you are persisting.
That Id can be used to query QBO in a simple GET request.
<baseURL>/company/{companyID}/timeactivity/{timeactivityId}

Instagram realtime get post from callback

Right, this is really working on my nerves, but Instagram has to do something about their bloody documentation.
I am already trying for a week to live update my website with new instagram posts without refreshing the page. Twitter was fairly easy, but instagram is just one big mess. Basically I use the realtime Instagram API, the callback and all that stuff is working fine, but thanks to Instagram it does not return me an ID from the post that is new, the callback only returns some basic stuff:
[{"changed_aspect": "media", "object": "tag", "object_id": "nofilter", "time": 1391091743, "subscription_id": xxxxx, "data": {}}]
with this data you are nothing, except for the Tag, but I knew the tag before this callback too so doesn't matter. It actually only tells me that there is a new post. I have tried doing the same request as when the page loads, when this callback occurs, and get the posts that are newer than those already on the page. Unfortunately I have not succeeded in this yet. I have picked the ID from the last posted instagram post, and checked if it is in the callback request, and it's not.
What am I doing wrong?
I'd appreciate some help, thanks!
Edit:
I'd like to note that this is not only a problem with the realtime api, but also with the normal API. I just don't know how to compare data so I don't get duplicates in my database(normal api), or on my website (realtime). I can't find any tutorial or documentation (Yes, I might be blind), that explains to me how to compare data. I can only find the min_id and max_id, but no explanation what these id's contains. I checked these id's with id's from results, and they do not match. It's not an ID from a media item.
I also checked the next_url, and in my logic thinking, this should be a URL to the next page (like Twitter).
Am I looking at this all wrong?
Ok strike my old answer, I changed the way I do this. Here's how I'll do it now.
I still wait for 10 hits on my Real-time subscription, when I reach 10 I send off a new thread (if one is not already running).
The sync thread queries my DB for a value, I need the last min_tag_id I used. Then I query:
https://api.instagram.com/v1/tags/*/media/recent?access_token=*&min_tag_id=*
Try it out here: https://api.instagram.com/v1/tags/montreal/media/recent?access_token=*
You'll get 20 results, and a min_tag_id value. Append that to your url, you'll see you get no results. Wait a couple of seconds and refresh. Eventually you'll get some media, and a new min_tag_id.
(You can ignore the "next_url" value they give you, you won't be using that).
Basically you only need to store that min_tag_id and query until you have no more results, that means you're done then.
When you get a subscription push, you need to query that endpoint (tag / recent).
I normally start an synchronous thread to perform this so I can answer in under 2 seconds to Instagram.
Then you parse that endpoint and look for a "next url" value.
Keep querying that end point, parsing the media and going to the next url until you find your stop condition.
For me I try to match 10 consecutive records in my DB. Basically from the tag, I store media when then meet my business rules.
The Instagram documentation is accurate and actually well written.
The realtime API is working correctly. As stated in the documentation:
The changed data is not included in the payload, so it is up to you
how you'd like to fetch the new data. For example, you may decide only
to fetch new data for specific users, or after a certain number of
photos have been posted.
http://instagram.com/developer/realtime/
You only receive a notification that an update has happened to your subscribed object. It is up to you to call the API to find out what that data is.
You can call the /tags/[tag-name]/media/recent with an access token that you have previously stored on your own server or DB. Then, you should be able to compare the data returned from that endpoint with any data you have retrieved prior, and just pull the objects that you do not yet have.