Get current User in MS Teams for Bots - email

I have a general question about ms teams, bots and get current user values like email or ad id.
The background is a bot integrated in teams. He is for general working and send some json informations to the bot (not based on ms bots framework). I can see this in my bot. What I see is my name some crypted ids and some other values more or less senseless for me. I am working with ms teams toolkit first and I see no direct way to integrate other values to the initial bot chat.
I can't see my email address or my ad id. Which one I want have inside the the bot as value without any question for sending an email back to the user.
I read the docs from ms about messaging, but they are not very helpful.
My question: how can I integrate additional values from the current teams session like email device name into the initial bot chat?

You haven't mentioned what language you're using, but I'm presuming Node given that you're using Teams Toolkit. In your bot, inside the various event handlers, there's a context object. On that object, you can access context.activity.from which has things (for example):
"from": {
"id": "29:[some long id]",
"name": "[user's name]",
"aadObjectId": "[this is the user's Azure Ad Object Id]"
},
So aadObjectId should match what you're looking for, "AD ID". To get the user's email, you need to make another call, as per here.

Related

Retrieve Data via Facebook webhooks on individual level

We create campaigns in our application and attach customers that we are marketing to. The dealerships may choose snail mail, ringless voice-mail, email, or social media. If the dealership chooses to do a facebook ad campaign, we then create a campaign on business.facebook and upload a list of the customers that we want the add distributed to.
What I am wondering is if there is a way to receive data via the FB webhooks event when the customer views/clicks/likes/etc the ad, that will include the data on the individual level so that we can update the record in our local database that the customer has performed an action, and what that action was?
I have scoured their documentation and cannot seem to find this information.

Automating SharePoint Online access for External Users through Flow/Azure

I'm quite new to SharePoint/Azure/PowerShell, so apologies if what I'm asking is a stupid question!
We currently have client SharePoint sites hosted on our O365 tenant, with access to each site to be rolled out to each of our respective clients shortly. Initially, only the senior management of each client will have access to the sites, however as time goes on it's likely we'll be adding everyone else too; To streamline the new user process and save us from having to add each individual staff member, we've been considering using a Flow to automate user access instead, with the goal of adding authenticated external users without much real input from administrators other than a simple approval/rejection process.
The overall plan is as follows:
Visio Outline<
Each Client site has a SharePoint Custom List, titled "Employee Access List". Said list will have the following columns: Request ID (Text), First Name (Text), Last Name (Text), Job Title (Text), Company (Text), Contact Number (Text), E-Mail (Text), SharePoint Access (Yes/No Boolean).
If a member of staff requires access to the SharePoint site, then their respective manager will add the staff member to the list and fill in all the above fields, setting the "SharePoint Access" item value to "Yes".
This will trigger the flow and an approval email to be sent to myself and another administrator, with said email detailing the user to be created, and who has submitted the request.
Script insertion somehow - This would then run if the request was approved, and set the user up with access.
Email notification is automatically then sent to the creator of SharePoint list item, notifying them that the user now has access.
Step 4 is where I'm a little stuck in regards to what to do if the request is approved - I've written a little PowerShell script below which nearly achieves what I'm going for, in that it creates an external user PnP Group and PnP Role Definition (If there isn't one already), pulls what's in the "E-mail" fields on the "Employee Access" list and runs Add-PnPUsertoGroup to pull the users to the PnP group, which then sends the users an email with a link to the SharePoint site, allowing them to access it. However:
The script I've written targets everyone on the SharePoint List, whereas ideally I would just want the script to target the sole user that's been newly added to the list/is listed in the approval email, and only them. I'm assuming that I'd have to pipe information from the Flow into a script, which I'm not even sure is possible, and if it is, I haven't got a clue how to do it.
I know that that Azure Functions and Azure Automation can be used to insert scripts into Flows, but I don't have experience of either so I'm not sure which is the more suitable option. Is there any guidance on how to insert PowerShell scripts with them, and how to pipe what's in a flow into said scripts?
PowerShell Script as follows:
Hope this all makes sense - Any guidance would be appreciated.
Thank you!
EDIT:
Just as a bit of extra information, here is the Flow as it currently is:
Flow Part 1
Flow Part 2
Flow Part 3
Have since found an answer to the above - whilst Azure Functions/Automation are an option, you don't necessarily need them or PowerShell scripts running from Flow, in this case my goal scenario was achieved using an MS Graph Invitation API, App Permissions and a HTTP SharePoint call instead.
See attached screenshots:
Flow Answer 1
Flow Answer 2
Flow Answer 3
Step 1: Set up an App with permissions to make calls to MS Graph - use this guide for help on how to do so - http://blogopaxio.azurewebsites.net/accessing-graph-api-from-microsoft-flow-using-application-permissions-2/
Step 2: Add HTTP to MS Graph and set parameters as in screenshot 1 of this post - this action will create guest user and invitation URL the user would need to sign in to the site.
Step 3: At this point, run the flow so that we can get the 'inviteRedeemURL' from the body of the Output for the HTTP step - you will need this particular URL to send separately in your email to the end user.
Step 4: Throw in a pause for a minute or 2 just to make sure that the information from the previous actions 'sticks' - provided it all works, at this point, the user will actually have their guest account created and you'll be able to see them under Users in your O365 admin centre, however they won't be aware of their account access yet (We'll notify them of this in our email at the end).
Step 5: Add the user to SharePoint security group with a "Send HTTP Request to SharePoint" action. Please note that the "sitegroups(19)" in the URI of this action refers to the ID number of the PnP group you're putting them in, so in my case the group ID was 19. If you're unsure of the ID of your group, connect to your SharePoint Site through PowerShell with PnP commands, then run Get-PnPGroup.
Step 6: Send the email to the invited user with the Outlook Send Email action - FYI -the "SharePoint Site" variable in my screenshot is actually the "inviteRedeemURL".
Hope this helps anyone else that's unsure of how to do this. If anyone has a better solution that achieves this by all means post it!
Thanks!

Retrieving Azure AD Invitation Redemption URL after-the-fact

We have a Powershell script that creates some guest users using the New-AzureADMSInvitation cmdlet, and its return value has a handy-dandy InviteRedeemUrl property that we include in a nice welcome email to the user to get them started with setting their account up and using our application. This works fine when inviting individual or small numbers of users.
However, we'll need to do this for many users, and carefully control when the emails go out, and I can't see any other way of retrieving this URL after-the-fact... the only option seems to be the "Resend invitation" button on the guest user in AD, which sends a Microsoft-branded email from "Microsoft Invitations" with the redeem URL, which is kind of a problem... For marketing reasons we need to put the invite redeem URL in our own welcome email, so we don't want Microsoft sending out those emails.
Is there any way to retrieve or calculate that invitation URL after the guest user had already been invited? I know I could delete and recreate the invitation itself, but that's still a manual process and I'd like to be able to create guest users in bulk first, and then retrieve those URLs in bulk once we're ready to send out emails. Especially since Azure AD itself seems to be able to fetch the redeem URLs later on via the "Resend invitation" button.
Alternatively , you can think of adding you company branding in the verification and invitation mails in azure AD.
Here is something similar you can find:-
https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-faqs#how-do-i-customize-verification-emails-the-content-and-the-from-field-sent-by-azure-ad-b2c
Basically you need to change the company branding in Azure active directory to have your custom logo and text.
Hope it helps.
We ended up modifying the AD invitation script to store the InviteRedeemUrl value in our CRM as a field on the customer record. Then later on when our Marketing team wants to start their email campaigns, they could include a reference to this field in the email template just like they would any other field. This way, we got all our analytics on click/open rates and retained complete control over the emails, including where each batch was being sent from (so customers could reply to the correct support staff member for their segment).

Automatic Facebook ad form data warehouse insights

I have a client's data warehouse in which I fetch a lot of data. I have a star schema for Newsletters and global emails. I also set up client's ads on Facebook and create audiences to target them right.
So, is it possible to connect the graph API/Marketing API to my database and make ad automatization?
For example, I would like to remarket people who for haven't opened an email. For sure I could do a select on my database (something like SELECT * email from newsletters where NLT_ID=1 and where opened="NO"; and then add these email in a new audience and target these people with the same content. But is it possible to achieve that (more) automatically?
If yes, with which program, is this Azure?
Please provide example also in your answer.

How can I track accepted invitation sender on facebook app?

Situation: user A send invitation to my fb app to his friends X, Y and Z. Users X and Y has accepted invitations, but user Z not.
How can I track haw many users accepted invitations? I want to take some privileges for user A based on accepted invitations count.
Is there any method to track sender_id when invitation accepted?
Don't bother, it's not allowed by the policy.
Per section V.1.
You must not incentivize users to
grant additional permissions or use
Application Integration Points.
And per the documentation about Application Integration Points
By "Application Integration Point" we
mean Application Info Section,
Application tab, Feed, requests
(including invites), Publisher,
inbox attachments, Chat, Bookmarks, or
any other feature of a user profile or
Facebook communication channel in
which or through which an application
can provide, display, or deliver
content directed at, on behalf of, or
by permission of a user.
Actually, there is no need to additional permissions.
Using the next value, you can store the referring user id and referred user.
It's simply explained here: http://fbcookbook.ofhas.in/tag/tracking-invitation/
You actually can do this. I'm doing it for other reasons (tracking how people get to the app and other analytics type stuff). In the , you can set the url attribute of the button. For instance, mine is . That url does some processing that will be saved in my database saying that user with userId 9999 invited the current user. This is being used to tell us the successfulness of invitations (our original idea was incentivization like you, but they pointed that out in the policy too).
This is how I do it:
track the invites by looping over $_GET['to'] on your 'thank you page' and store these IDs (= to_id) against the current user ID (= from_id) in your DB.
When a new users signs up, compare the new ID with the to_ids the table. If it's a match, honor the corresponding from_id
Drawback: if somebody was invited by 2 or more ppl you don't know which invitation to honor. I just honor all invitations which makes everybody happy.