Implementing Facebook's Like feature using Google Cloud Messaging - google-cloud-messaging

I have a use case to implement a 'like' feature for messages using GCM. One approach that comes to mind is to make each post a 'topic' and then send all likes on a post as a separate GCM message on that topic.
However, in order to achieve this, the client has to register for each topic corresponding to the post that it has loaded on the UI in real time. This brings me to the following questions:
This is approach right?
How long will it take for a client's subscription to a topic to reflect at GCM's end? Same for unsubscription?
Can I get a list of all subscribers to a given topic?

Related

Assigning webhooks to Firebase Messaging "subscribe to topic" event

In my current project I am using the Kreait Firebase PHP SDK to send out push notifications to Android & iOS devices that have subscribed to notifications on named topics. No issues thus far. However, rather than have fixed topic names I would now like to generate topic names based on the current "condition" of the connecting device. The condition could, for example, be a geographic location.
This is not too difficult either and I have modified my app to handle this. However, in order to put the ability to have such autogenerated topics to use I need to know the topic names on my server so I can send out targeted messages via Kreait. I find Google's Firebase documentation a bit dense at times and have not been able to establish whether it is possible to assign webhooks that get called by Firebase whenever a SubscribeToTopic, UnsubscribeFromTopic event occurs.
A simple question - does FCM even offer anything like this capability? If so, any pointers to the relevant documentation would be much appreciated.
There is no public API to get a list of topic names from Firebase, nor is there a way to hook into the subscription mechanism.
Your best bet is to simply make two calls when a user subscribes to a topic: one to Firebase, and one to your own backend API that keeps a list of active topics/conditions.

Sonos Cloud API Queues

I want to develop a Sonos Controller that is capable of:
Playing a playlist or album now, or next (after currently playing song) or by appending it to the end of the queue.
However I can't see a way to control how the playlist is added to a queue. The documentation at https://developer.sonos.com/reference/control-api/playlists/loadplaylist/ doesn't suggest that it is possible,but there is a reference to the queue in the description for the shuffle playmode "Play the tracks in the queue in a randomly shuffled order."
There is documentation for "Cloud Queues" but this seems to be targeted at Music Services.
Is it possible to create a Cloud Queue that just holds references to tracks in other services?
Not that I would really want to implement that, I would rather just access the queue that is on the players.
The Sonos Control API does not currently allow for direct access to the player queue. Third party integrations can get content on to the queue via the playlists and favorites namespaces, but they can't touch the queue directly.
As you noted, the Cloud Queue API is intended for Content Partners. It is not directly possible to reference third party content in personal CQs, there are authentication issues involved.
This squares with my user experience of the Sonos queue being very basic and unintelligent. There have been a number of times I've been forced to clear the queue and start over, rather than being able to reorder items, etc. FWIW, the closest thing I've seen in their documentation to what it sounds like you're looking for, is under a different API. Sonos Music API > reorderContainer as documented here: https://developer.sonos.com/reference/sonos-music-api/reordercontainer/
I don't see any similar functionality documented in the Sonos Cloud Queue API. With regard to random order, I believe that's on playback, not anything that modifies the queue.

API Whatsapp to send messages from an external application

I want to implement Whatsapp
to send information from an external application. The idea is to use this
external application to send information throughout Whatsapp.
If you can help me about the terms and
conditions and if this query is possible to develop.
There is a way through which you can send WhatsApp message from your self created application. Use this link Chat API.
But it only provides 3 days trail period and after that you have to purchase it.
The process in that is, you have to register with your google account, then scan the QR code provided(which changes after every 45 seconds). and you are set to go, they will provide you the API for : PHP, Node.JS, Jquery, CURL.
One thing more you always have to keep your phone connected with the internet everytime.
Also I found a drawback in that, i.e. they also provide API to read messages, but it is too slow, as in my condition I can see my messages of yesterday but not of today.

Cumulocity extend API

We're working with Cumulocity and we'd like to offer services to our customers that are not currently possible to implement with Cumulocity. As an example, we'd like to be able to retrieve a list of devices located within x kilometers of a given point.
Currently there are two limitations that prevent us from doing so:
the impossibility of extending the Cumulocity API with custom route/parameters
the impossibility of implementing custom functions for specific API GET calls
I can think of a workaround to achieve this, like a POST request of an event that would be processed by an Esper rule, generating another event/measurement that could then be accessed by a GET. But I think we can agree this is not a suitable mechanism.
Please not that the use case I described above is just an example. Our needs don't limit to this and we need a standardized way to expand our services without requirering updates on Cumulocity side.
There are two topics here, I believe:
Geo-querying: Some geographical querying and aggregation use cases can be handled through CEL. A general geo-querying API is on the Cumulocity roadmap. Note: This use case is not only related to extending the API, as such queries go right down into the database.
Extending the API: That is actually possible. Cumulocity has a microservices API in which you can expose other APIs under the URL /services/.... This is, for example, how connectivity platforms are interfaced. The API is not on the web site because it's not GA yet, but you can certainly discuss it with your Cumulocity contact or open a ticket. This btw includes also adding permissions for the new microservices, so that you can do proper A&A.

Telegram Automation

I'm working on a program, it's mission is that we define some number for it (some of our mobile numbers) and it should register them in Telegram, and then gets all messages that send to that number. As you may know, the registration in Telegram needs providing a phone number and after that a validate the number by a code that is sent from Telegram.
I read Telegram API, but it was complex and with no certain example and explanation.
I need your help, Thanks.
To implement Telegram chat,
First of all, you should obtain your own api_id and api_hash as described here.
Read the document and get ideas about the terms used in the Protocol which will be useful to go further.
Create a TCP connection with Telegram Server via port 443.
Telegram uses a key called 'Authorization Key' (ie Auth key) for Encryption/Decryption and it will be derived in both Server and Client using Diffie-Hellman Algorithm by various steps. You can create this Auth key by following the steps explained here and you can also see a sample for this process here.
When you are successfully done all steps, you will finally receive 'dh_gen_ok' response from Telegram server.
Now you can send RPC queries (Telegram APIs). The list of APIs is given in this link https://core.telegram.org/methods
This is just brief points which will help to give an idea about this. To implement the whole process, you need to read the documents and get to know the flow and all its limitations. Hope it helps :)
Yes you can do this
BUT
first of all, you should write a program (class) for one number
and after that
create another instances of that class for another numbers
if you write main class (work by One phoneNumber)
it's very simple to extend you program to work by many numbers
Good Luck !!!