Are FCM topics name globally unique? - firebase-cloud-messaging

We can create a topic to send a push notification to more than one user at the same time with the following request:
POST: https://iid.googleapis.com/iid/v1/IID_TOKEN/rel/topics/TOPIC_NAME
Plus the headers:
Authorization: key=YOUR_API_KEY
If, for example, I name a topic "topic", it's quite a common name and surely someone else must have done the same before. Am I sharing the same topic with other people, or are these topics that I "created" mine based on my API Key?

Firebase Cloud Messaging names are scoped to your project. So your topic names won't conflict with topic names in other projects, but they will need to be unique within your project.

Related

Hangouts Chat: how to retrieve project_id or client_id in incoming event request?

I have setup a fully operational chat bot in Hangouts Chat orchestrated by a tailored webserver. I would like now to be able to have this webserver to interact with other Hangouts bots that I created and to route some requests to some of my other servers that will have to know which bots initiated the event.
With other provider, such as Slack, the app_id is provided in the event request data.
But with hangouts, this is not the case. I could not find any data in the request body or headers that represent either project_id or client_id.
In a more simple way my question is : "How to identify the Hangouts bot that send me an event request?" :)
An event request's response will contain an Event instance in its body, which one of its fields will be an User object. That User object will contain a name field that will represent the user's id (whether it's a human or a bot).
It will look like this:
{
"name": "users/<id>",
"displayName": "<name that appears in the chat>",
"type": "BOT"
}
One month later, I finally found the time to answer my question :)
In order to identify the Hangouts project that is calling your server, when you receive an event from Hangouts Chat, you'll find in the incoming request the header Authorization whose value is something like Bearer abcd1234.
If you decode this JWToken (ie, abcd1234 in our example), in the resulting data, you'll have a field aud which is exactly the "project number" of your Hangouts app. This "project number" can be found at "https://console.cloud.google.com/home/dashboard?project=referenceofyourprojecthere".

Microsoft Teams webhook payload contains unusable Teams ID

I have created an outgoing webhook for MS Teams. I pointed this to an Azure Function App which checks the authentication token and then forwards the payload through another webhook to a Flow (Power Automate) which replies to the original message in Teams.
This post addresses only one of the many problems this roadmap has, namely that the payload contains (amongst much else) the Teams Message ID, the Teams Channel ID and the Teams Team ID, as follows:
messageid=1578517604597 CORRECT. This is great
teamsChannelId=19:99c0a47caa884ffeabefc59305523414#thread.skype. This may look wierd but it's correct
teamsTeamId=19:c374b6b6d8cf4f17a9c77cd45399e90c#thread.skype Well this appears to just be wrong.
If I ask Flow to post a reply to the message on teams it will complain that the group ID is incorrect. It is referring to the Team ID.
If I open the original teams message in a browser and look at the URL I find the message ID and the channel ID as above. But the groupID is as follows:
groupId=006ff9ad-fdcc-4705-b651-93eef04361dc
Putting this in Flow works!
But if I search for this value in the JSON payload it is nowhere to be found!
Can it somehow be derived from the TeamID?
Any help is appreciated.
Thanks

Identify unique user in Dialogflow V1

So I am testing out Dialogflow and one of the first questions I have is: how does my bot know who it is talking to? I need to identify a user and keep that information for as long as I can. The basic scenario being:
User starts his/her first conversation.
Chatbot send a fulfillment request to the server trying to match a user within its own database.
The user is found, the information (as a JWT or some other token) is sent back to Dialogflow and stored there for further communication. In reality, this part would involve asking for user email, sending a verification code to that email and then verifying the user with the code.
User then starts chatting with a bot and all fulfillment requests get the unique token stored for this very user, so that my REST API knows which user is being served with the response.
Couldn't find anything about it in the docs (maybe I am looking in the wrong places).
There will be several integrations, like Messenger, Viber, Telegram. I dunno, maybe those APIs add some unique information on the user?...
Thanks for the help!
Sorry, I know it's been a while, but maybe this will help someone else.
The right solution here is a user id, not a session id. A user id is provided by the chat platform (Facebook, Slack etc) and is consistent across sessions for the same user.
To get the user id, go to the Fulfillment tab, enable the editor and use a function like so:
let r = request.body.originalDetectIntentRequest
//this makes sure that you're on an integration
if (r["source"]){
return r.payload.data.sender.id;
}
To tie together ids from different platforms, you probably have to have some kind of log-in process every time you encounter a new id on a platform.
Pop,
Sessions are built in already into DialogFlow requests to your fulfilment service, if you check the payload you will find a sessionId, it remains the same for the same client until it expires.
However if you want to identify the user from any of the clients that you can connect to DialogFlow like Messenger then from the same request payload to you you will notice that there is an object named originalRequest that is only available when requests are coming from those clients.
You can personalize those users response eg using their FB firstname in a message to them.

Podio API - webhooks insights

Since apparently you're not reachable for API questions via email, I guess I'd have to put all the questions in here since it would be tedious to create one for each of them.
So we're planning on creating a webhooks system for our integrations to create a better experience for our users. There are a few pieces that are missing for our end to support having a Podio integration that runs 100% on webhooks.
Support organization level webhooks instead at the space level.
Send full object payload in the webhooks push so we don't need to fetch the resource again. Or at least provide a delta of changes.
Have a secret token header that you send with each request so we can assure the authenticity of the data (that it's actually from Podio and it's not someone trying to hack our system).
Github does a great job with this: https://developer.github.com/webhooks/#delivery-headers.
Ability to unsubscribe from a webhook if the client revokes the OAuth credentials. Do you automatically delete that webhook or do we need to contact the user or you guys to get rid of it?
Trello for instance deletes all webhooks associated with a token if it's revoked or a second option is our server sends a 410 Gone back and the webhook, well you guessed it, it's gone.
Do you think something like this is feasible in the near future?
Thanks for your insights :)
Seems pretty valid point. Are there any particular org operations that you are interested to have webhooks for? Can you also describe some use-cases for org level webhooks?
Sending full object payload is pretty complicated because items in Podio can be extremely big and it might be not needed for webhook to get all details. That's why we keep it small and tiny and let Podio partners build own complicated solutions based on webhooks.
Secret token is not much needed if there is only item_id sent in webhook. Let's review it on item modified scenario.
1) User (or anything else) modifies item
2) item.modified webhook is triggered with item_id
3) 3rd party app receives webhook
4) 3rd party app makes a call to Podio API (if it's needed) and gets all required information from Podio API
So, if webhook request is fake, then Podio API will return same item details and nothing is affected. If you want to have some extra layer of security: why not making webhook URL unique and specific to webhook? Then only Podio will know which URL to use to trigger this webhook.
Ability to unsubscribe from a webhook if the client revokes the OAuth credentials.
Sorry, but I don't understand your question. Can you please re-phrase it as new StackOverflow question?

Using Exchange server as a bridge with APIs?

does anyone know if it's possible to use Exchange server as a bridge with APIs ?
In my company, we have some APIs (like mail, contact, calendar ...).
We are searching a solution to synchronize contacts and calendars from our APIs on smartphones (without any optional application).
For example, I add an Exchange account into an iPhone. I choose to synchronize my contacts. We want the Exchange server to query our contact API which will return a Json encoded response. Through a Exchange plugin, we could transform this response to match with the Exchange format.
We didn't want to store any datas into the Exchange server to avoid redundancy.
Does someone think that there is a solution to do this ? (I saw that there are 2 or 3 SDK for Exchange but I didn't find some informations about what I'm searching. Otherwise, I'm not an expert in Microsoft Exchange :/ )
Sorry for my bad english :)
No, you cannot do that.
Exchange will not be calling you, it is your responsibility to call Exchange to request existing data or create new items in one of the Exchange mailboxes.