Facebook SDK - Handling application invites? - c#

With the Facebook SDK it seems like they allow you to invite your friends to join the application through the AppRequest section of the SDK. However I don't see anywhere in the SDK where you can reward users for inviting friends. I know this is possible because it's been done so many times, so how it can be done?
For example, lets say:
1. User A invites User B to use the application.
2. User B downloads the application.
3. User A receives 100 coins for inviting User B.
I'm completely lost here, examples using any SDK, regardless of language, would be appreciated.

Since Facebook app invites are based on AppLinks, that is where you need to look for a solution. I will explain this by using an Android example scenario.
When constructing an app invite (using the dialog), you are specifying an AppLinks URL. This URL can be unique to each user that sends out invites, or even to each individual invite. E.g.: https://www.example.com/invite_applink?invite_id=12345. By creating one AppLink url for e.g. each user who invites others, you embed invite-sender attribution (which is what you are saying you want) into your AppLinks URL.
The way the Facebook app figures out how to open your app from the "app invites" section, is by following the AppLinks specification.
This specification states that in the <head> section of the HTML document that lives at https://www.example.com/invite_applink, there has to be appropriate <meta> data that describes how your app can be opened/deep-linked into. One part of that is the al:android:url property, which could be used like this: <meta property="al:android:url" content="example://invite_from_fb?invite_id=12345" />
Observe how the url contains a parameter invite_id=12345, where 12345 is the same value as the one used in the invite_id parameter of the AppLinks URL above.
When the invited user now opens the app from the deep-linking URI example://invite_from_fb?invite_id=12345, the app will be opened from an intent that contains this information.
When your app's Activity opens you can grab the Intent that opened the Activity, and get from it the Uri that was used to open the app: Intent.getData(). More on this on the Android docs on "Allowing other Apps to Start Your Activity"
At this point, the ID that attributes an app invite to a user has made from the sender into the running app of the recipient. Now the app on the recipient's device needs to call your server and let it know which invite_id was used to open it. To avoid that multiple such attributions originate from one user (who may have received invites from multiple people), you could hold off on sending this attribution data until the user has performed some sort of login (e.g. Facebook Login) and you are able to ignore e.g. all attributions after the first one.

Related

How to Fix issues related to DirectLineChannel prompt choice options not displayed in chat bot window developed using V4 SDK in C#?

I am trying to create a chatbot which is having multiple waterfall dialog classes using C# and BOT SDK V4. I have created a HTML page and placed the DirectLine channel Secret Key Iframe data into it and published it to Azure successfully and opened it in the browser. The browser opens with a in-built welcome message something like: Hi bot name type Hi to continue.
If i have Choice options done through prompt options to be displayed as buttons but these are not displayed through direct line channel but works very good in Web Chat Channel?
Attached image shows the issue:
a "WebChatbotHtml_optionbtndisplayed.jpg"
b. "DirectLinechannelHtml_optionbtnnotdisplayed.jpg"
Now, in the main dialog class i have implemented the Login mechanism using the Oauth Prompt in th html page that was created above i see the login link getting displayed using which i have successfully logged in this will navigate to another waterfall dialog having prompt options with some custom choice buttons, whee if i click on a choice button the next step will be executed and respective action will be triggered.
The issue i have is normally the options are displayed for me to access but in the html that i created the all other things like login link and navigation is happening but the choice buttons are not displayed its like they are getting hidden.
or Sometimes the Choice Option buttons are not displayed at all in the Direct Channel Web chat bot
The query is how to fix the issue?
To make my query to be understood in a better way please find below set of things:
1. WaterfalldiaglogClass1:
STEP 1: Has login option/link displayed through Oauth Prompt.
STEP 2: Gets token validates it and displays login successful message and then navigates to second waterfalldialogClass
2. WaterFallddialogClass2:
STEP 1: Custom choices are displayed through Prompt options lets say 1,2,3,4
STEP 2: Capture the choice getting clicked and perform respective action
I created a HTML page where the I frame code i copied with secret code of Direct Line Channel
Published it to azure successfully with no errors or warnings
Opened the html page in a browser the chat bot opens successfully with a welcome default message like: HI i am bot,enter Hi to continue
User sends hi and logins using the login link available displayed in dialog class 1 and login successful message is displayed
Navigated successfully to second dialog successfully as i can see the prompt message given as part of prompt option and custom choices in the code
Current Issue: The option buttons 1,2,3,4 are not getting displayed it is getting hidden somehow
Need help in resolving the issue Please provide detailed step by step guide in resolving it as i am new to BOT and coding .
language: C#
Bot Framework: V4
I have tried increasing height width and other % values in the HTML page and republished it but not successful. The same thing works in web chat channel i.e. if i keep secret code inside the HTML page of webchat channel without any issues.
Issue Image attached for reference.
Expected Result: Data or choices should be shown as it is working in Webchat channel
Actual Result: Not working the choice options are not visible to choose
There are two versions of Embedded Web Chat at the moment: Gemini and Scorpio. Embedded Web Chat is currently in the process of slowly transitioning all clients from Scorpio to Gemini. It appears your embedded Web Chat is still using Scorpio which unfortunately does not support the OAuth prompt. In the near future, you will be able to manually request your client to be switched to Gemini.
In the meantime, you can add either add Web Chat v4 to your site using a CDN or wait for your client to be migrated to Gemini.
For more details regarding Embedded Web Chat, take a look at the documentation.
Hope this is somewhat helpful.

App pop Up saying "... Would like to access your (Camera, location, photos, etc)"

Using Xamarin Ios. in Apps theres usually a pop up on launch that says "(app name) Would like to access your location" or photos, or things along these lines. i couldnt find any information on how to implement this, or even what this confirmation/permission process is called. can someone point me in the right direction? it would be much appreciated
When your application needs to invoke some function that involves user privacy,suah as Camera,Contacts andLocation Services. You will be prompted for authorization by the system.
You should add items in Info.plist As shown in the following image.For example if you want to use Location Services. Otherwise it will be rejected when you want to upload your application to APP Store.
There also some other privacies.Here is a document link for you to referring to:Apple Document

How can I have my bot start in a different dialog depending on user

Basically, I want to have my bot on different pages using iframes and Bot Framework Web Chat.
Depending on what page the user opens the bot, a different dialog is called.
Without Direct Line, this is as simple as adding a query parameter to api/messages and adjust the controller. But with Direct Line, I can only specify one endpoint in the portal.
I tried to change user.id in the JavaScript BotChat.App call to a different identifier and then select the correct dialog in my MessagesController based on that.
BUT: my custom id doesn't seem to be available as early as the activity "ConversationUpdate" occures where I send my welcome message. I need to send a dialog-specific welcome message though (so I need to navigate there as soon as possible and not only when the user types his first message).
Take a look at the backchannel. In your scenario you can pass a parameter from the Javascript via the back channel to set some value in UserData. Now your parameter will exist in state (in this case the IDataBag UserData) when your user first hits the bot.
Here is a C# sample of a 2-way backchannel
another C# sample using a 1 way backchannel

C# autologin to website using desktop application

I have a website in PHP Laravel 5.2.
I want to create a desktop application (something like drop-box application for windows) using C#, in which there will be a button "Open web", clicking which the logged-in user (in desktop app) should get logged in to the web-site without asking any credentials.
In web-site, I am using api_token based authentication.
There is a possible way I can make an end-point in web-site to check the token an make user logged in if correct, but I think it is less secure.
I've checked request-response log in fiddler for drop-box "Open dropbox.com" button, it does not sets any token in request.
The question is how can I achieve it?
One way would do the following:
Request a use-once (a nonce) unique code from the server in your desktop application, that refers to the user you want to log in as
Open a webbrowser process with an address that contains this use-once code, something like this:
http://www.your.server.com/the/page/you/want?auth=29874298798724982734
The way Dropbox does this, is to create a temporary html file on disk which contains some javascript code that posts a "form" to a secure page on their server
https://www.dropbox.com/desktop_login
form fields:
buildno=Dropbox-win-7.4.30
u=home
c=en_US
i=<some number>
n data-nonce-c=<some large hex string>
Then it spawns a webbrowser process to open this file.
To see this file, use the globe link in your Dropbox app and then hit Esc as soon as the initial web page loads and grab the url which should look like this:
file://C:/users/USERNAME/appdata/local/temp/RANDOM.html
Then open this file to inspect it.

Google Admin Directory API SDK User Last Logged In Not Fully Accurate

I use the .Net API for managing my organization's users within Google Apps. Within the directory API you can "RetrieveUser". This returns a User object that has a date property of "LastLoginTime".
Google used to separate out their Last Login Time for an account into three categories using the previous api.
last_login_time - the last time you directly logged into a google service using a UI
last_web_mail_time - the last time you logged into gmail.com webmail
last_pop_time - the last time you popped or imap'ed from their server. (indirect login)
In the new SDK, I don't see a specific "How we populate this" comment within their documentation. I'm wondering, and having trouble testing to figure out the rules myself:
How this is populated?
If it is not all encompassing usage that updates this date (usage meaning ANY interaction between the user and their account), how do I get other dates?
I use the last usage date to recycle idle users. Thus I need an accurate representation of what this date is. I've tested, and it appears popping from a google account is not represented within the SDK LastLoggedIn property, even though you need to log in to pop. Thus, any user that pops from the account and doesn't "Log In" could be deleted by accident.
API Reference
Appreciate any help.
These three (And more) properties still exist, just not attached to the "LastLoginTime". If you want to know if an account is truly idle, you'll need to use the Google.Apis.Admin.Reports.reports_v1 API. You can install via NuGet.
After you make your service object (Many stack answers can show you how to do this), usage is below:
UserUsageReportResource resource = _service.UserUsageReport;
UserUsageReportResource.GetRequest request = resource.Get("User#domain.ca", "yyyy-mm-dd");
UsageReports report = request.Execute();
All the interaction dates will need to be searched through, including LastLoginTime, and then take the latest. Each application has different dates all pertaining to when the last time the user did X action.
LastLoginTime appears to be simply the last time a user directly, or indirectly (via device), logged into the Gmail service. This does not include logging in for pop etc.

Categories

Resources