Azure Communication Service - pre create a video meeting for specified date and time and record the link - azure

Azure Communication Service -
Is there a way we can pre create a video meeting for specified date and time and record the link so that it can be sent to the participants. and invoked at specified time

I have a solution, although it's not the best solution. It IS a solution.
MS has offered a JS option that wraps the react components.
https://github.com/Azure/communication-ui-library/tree/main/samples/StaticHtmlComposites
Directly from the sample,
const callAdapter = await callComposite.loadCallComposite({
containerId: 'video-call',
groupId: '', // Provide any GUID to join a group
displayName: displayName,
userId: user,
token: token
});
in my testing I was able to plug in any randomly generated GUID, and share a link with that guid to my co-workers who were able to join the video call.
Hope that helps lead to a better solution. I'm still trying to get this thing working friendly with MVC. I may update when I get that working.

Related

Shopify Webhook Real Time changing

is there an api on shopify where I can see real time when data changes ? Maybe I have a node server and I use sockets to see when anyone has bought anything from my shop that I get a notification via nodejs on my backend. is it possible ? a few websites has this, they offers you to sell on their site and you can see real time changes data when anything was bought
Yes, you can subscribe to multiple Webhooks to get notified when a change occurs on your shop. Using the REST Admin API, available webhook event topics include:
orders/create: occurs whenever an order is created / someone buys from your shop.
orders/paid: occurs whenever an order is paid.
orders/fulfilled: occurs whenever an order is fulfilled.
orders/cancelled: occurs whenever an order is cancelled.
Use the /admin/api/2023-01/webhooks.json endpoint to subscribe to a webhook:
// Node.js - Session is built by the OAuth process
const webhook = new shopify.rest.Webhook({session: session});
webhook.topic = "orders/create";
webhook.address = "https://example.hostname.com/";
// format you want to receive the event data in
webhook.format = "json"; // or XML
// fields you want to receive
webhook.fields = [
"id",
"note"
];
await webhook.save({
update: true,
});
You can also use the GraphQL Admin API for the same purpose.

How can I generate user's QR-code in node.js?

First off, I need some suggestions regarding QR code in my app.
I am building a parking-management app in node.js in which there are different tables like user, booking, parking etc.
Now, Users will search for parking availability and book one parking-slot and based on that details the QR code will be generated. now whenever user go to that parking place he needs to show that QR-code to the parking attendant. The parking attendant will scan the QR code and will verify the details and the in database there is a field called isStarted will become true(Initially it was false). So the questions are:
Do I need to generate QR-code in the back-end and store it to the database or It will be generated from the front-end Side?(I think I don't need to generate it in the backend I just need to decrypt it)
If it generates on the front-end then what approach should I take to decrypt it?
It is not related to the QR-code but still asking. I want to notify the merchant(parking-owner) about the details of user who wants to park their vehicle in the merchant's space. How can I do that with node.js? I have some code already written by someone which is as following but I don't understand what it is.
let notification_data = {
name: `${owner.basicInfo.fullName}`,
date: dayjs(req.body.date).format("MMM DD, YYYY"),
startTime: req.body.startTime,
};
let { title, body } = notificationTypes.addBooking(notification_data);
let data = {
senderId: req.data.id,
receiverId: req.body.walkerId,
title,
body,
};
sendNotification(data);
Can anyone here help me with above queries?
you're welcome,
You can create a token user data in the backend by using the JWT library,
and append in query link you want for example:
https://example.com/page1?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlNWI4OTdmODhlMDYxMzFlZjA2MDA5OSIsInR5cGUiOiJ2aWV3ZXIiLCJ0b2tlblR5cGUiOiJhY2FkZW15IiwiaWF0IjoxNjU5MzU4MDE0f
and in page example.com/page1 send request to back-end with token in query and in back-end decrypt token and use it.
for notification use https://www.npmjs.com/package/fcm-node and send notification This link can help you : https://code-boxx.com/push-notifications-nodejs/
You can leave the creation of the QR code to the frontend, but with the data that the backend sends to the frontend, and in this way, the frontend can also scan the photo and send the scanned data to the backend, and any necessary operation can be done in this way.
You can also have the QR code through the back through the link below:
https://www.npmjs.com/package/qrcode
Regarding question number three, you can also use FCM and web push mechanism.

How to retrieve all user tokens and send FCM to all

I am trying to send a FCM to multiple users at a time. I can't seem to find a clear answer other than using a topic but i have several conditions which make this quite difficult on my side. Is it at all possible to extract all tokens from a particular document (similar to setting it up as a topic but based on my logic) and pass that array to the Cloud function?
My current code is as follows and it works for a single user (i am only posting the part where the token is extracted):
return admin.firestore().doc('Seller_tokens/tokens/' + brand + '/wc').get().then(usertokensdoc =>{
const sellertokenID = usertokensdoc.get("dXufWMvOTLXUOyj8XNv9NFmsQ4x1");
const payload = {
data:{
title:'FCM - Test',
content: 'FCM - This is a test message,
},
token: sellertokenID
};
for the line:
const sellertokenID = usertokensdoc.get("dXufWMvOTLXUOyj8XNv9NFmsQ4x1");
I do not want to specify a single userid, where the 'userid' is the field in the document . And hence I would like to pass an array, if possible.
As you mentioned and as clarified in the official documentation Send messages to multiple devices, there are only two ways of sending messages to multiple tokens:
Firebase Cloud Messaging provides these two ways to target a message to multiple devices:
Topic messaging, which allows you to send a message to multiple devices that have opted in to a particular topic.
Device group messaging, which allows you to send a message to multiple devices that belong to a group you define.
In addition to this, as mentioned in this other question here, there is no API for you to get all tokens at once, so, you will need to get the individually for usage.
So, to summarize, there is not an automatic way of getting the tokens, but once you get them, I believe using the Device Messaging way would be better for you, since you can define specific groups to receive the FCM, per tokens that you retrieved.
Let me know if the information helped you!
you can retrieve the token documents based on your conditions in cloud function. loop through them, create an array of tokens and pass them to Firebase messaging as below
admin.messaging.sendToDevice(tokens, payload). below url has a very good example.
FCM - Cloud Functions Example

Has azure user ids changed their format?

Good evening ppl at Microsoft!
I have an Mobile App Service at Microsoft Azure Located at South Central US named CeneamApp.
My backend is configured in a way so that my user can access only the data they capture, by making use of stable user ids.
so I had followed Adrian Hall book to create an a user id (https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter2/authorization/)with the following format sid:{identifier}as described here: (https://github.com/Azure/azure-mobile-apps-net-server/wiki/Understanding-User-Ids).
now all my userid had been changed and my user cant access their previous data capture by them, because somehow the provider or issuer or whatever is going on, doesnt let me retrieve a user id as described by the github project team wiki (in the previous link). so instead i receive a new userid but seem to be a random number:
I'm adding screenshot of the essential part of my code at my backend project which i debugged so i could understand whats going on and my dummy database where you can see an stable_id save on it and the new suppose stable_ids the next two rows.
Debugged code retrieving apparently a new userid from FACEBOOK could you confirm about this change? because I havent been able to understand this change.
Dummy Database with the lost userid and the new ones from other accounts database screenshot
if anyone has information about this odd behavior i would appreciate to enlight me, because this line of code:
principal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;
used to give me a user id with this format: "sid:{identifier}", now the format is a the screenshot shows.
Same situation here. About to go live and suddenly this. Interesting that only one Mobile App based in the UK datacenter is affected. Other 2 apps which are in production and plus another Web App are still fine.
The full solution can only be provided by Azure team. But I have a workaround and and idea:
1. Workaround.
In the base controller I read and parse the token from the header. The sid is in the subject of the token. The code is simple:
string _userSid;
public string UserSid
{
get
{
if (_userSid == null)
{
KeyValuePair<string, IEnumerable<string>> auth_header = Request.Headers.FirstOrDefault(h => h.Key.Equals("x-zumo-auth", StringComparison.InvariantCultureIgnoreCase));
string token = auth_header.Value.FirstOrDefault();
if (!string.IsNullOrEmpty(token))
{
var jwtToken = new JwtSecurityToken(token);
if (jwtToken != null)
{
_userSid = jwtToken.Subject;
}
}
}
return _userSid;
}
}
I use it instead of getting this from ClaimPrinciple as per manual. I checked the Mobile App Server code does a very similar thing.
2. Idea.
Azure Mobile Apps have this parameter:
MobileAppsManagement_EXTENSION_VERSION it is recommended to set to latest. I think if we downgraded it to previous version it would work until Microsoft finds and solves the problem. The only issue is that I do not know and could not find the version number. May be someone knows and can post here?

Instagram changed policy to retrieve posts with hashtag

Instagram has changed policy since June 1st. Now my code which used to fetch posts with certain hashtag in a website stopped working.
According to this new policy, the app needs to submit for approval. But when i went through approval process, the privacy policy is a must and which should describes how this app would use data. and when i went through sample instagram policy this is huge and mostly deals with mobile app.
Now my qeustion is, do i need to write something like this when my app just needs to use client id's secret keys and general stuff just to fetch posts with certain(defined) hastag ?
I have used instafeed.js to retrieve posts by hashtag.
var feed = new Instafeed({
get: 'tagged',
tagName: "<?php echo $tagname;?>",
clientId: "<?php echo $client_id;?>",
limit: 14,
template: '<img data-attr="{{id}}" src="{{image}}" alt="{{caption}}" data-username="{{link}}" />',
});
UPDATE :
It looks like we won't be able to fetch particular hashtagged public content in our website.
Also, in the alert section As alternative solution, ..... find a company that offers this type of service (content discover, moderation, and display).
What are these company instagram talked about ?
We're in the same boat. The only one I've found so far that claims to be able to do this is called Dialog Feed. Here is their blog post about it: https://www.dialogfeed.com/instagram-api-not-working-solutions-for-hashtag-and-profile-search/
They are not cheap, however. Like 890 eur/year not cheap for just the basic.

Resources