Can we somehow get the curret state of website where the bot is embedded as IFrame?
As in for example, the bot validates whether the user is logged in or not, or his login credentials. Hence, I should be able to pass user's account id along with some other info as well into the bot's code. Then, accordingly, the bot displays the options differently.
I've seen such bots implemented on Industry Websites using bot framework itself.
So, any idea how to work this around?
Hence, I should be able to pass user's account id along with some
other info as well into the bot's code. Then, accordingly, the bot
displays the options differently.
Use webchat's backchannel functionality. You will have to switch from the basic iFrame to a few more lines of code, but it's working well.
Change the webchat implementation on the front side
Add the post of an activity to send the necessary information (still on the front side)
Get this activity on your bot side and handle it
See my other reply around this functionality here:
How do I get the locale in conversationUpdate activity?
I should be able to pass user's account id
You can pass the user's id and name using the embedded code.
<iframe src='https://webchat.botframework.com/embed/bothandle?s=YOUR_SECRET_HERE&username=YOUR_USER_NAME&userid=YOUR_USER_ID'></iframe>
To pass details other than the user id and user name you need to use the backchannel method in the web-chat repo. Here is a sample doing the same.
While it is possible to access the parent page from IFrame using JavaScript's window.parent, I doubt that it is the ideal approach. A better solution would be to expose an web API that would provide the required data, which would the bot's code call to access required information.
Related
I'm trying to create a program that sends messages to groups from time to time. If I'm not mistaken, the only API I see that send messages is "Create Post" which is the "Team Messaging" section. This API uses Glip permission. The test messages that I was sending is being sent to the developer Glip-App account, when I logged into the Glip-App account, the page didn't look like the regular RingCentral app. The UI is different. I have a feeling, that I am working on the wrong API.
I also have few more questions. My program is only required to send messages, but in order to apply for production, I have to practice other API calls as well, such as Get, Delete, Update etc. I'm not sure why it is like that. Also, I had to practice all the permission given, but the only permission I have given is Glip and it's still in the red.
Finally, the test messages that I've sent, showing the user's actual name on the Glip App page. Is there a way that I can use an alias?
The test messages that I was sending is being sent to the developer Glip-App account, when I logged into the Glip-App account, the page didn't look like the regular RingCentral app.
There are two developer sandbox accounts for RC App now, one for the new App and one for the legacy app. At this point, you should be using the new URL. The legacy URL still exists for testing purposes and will be retired at some point in the future at which time the URL should redirect to the new URL.
New: https://app.devtest.ringcentral.com/
Legacy: https://glip-app.devtest.ringcentral.com/
My program is only required to send messages, but in order to apply for production, I have to practice other API calls as well, such as Get, Delete, Update etc. I'm not sure why it is like that. Also, I had to practice all the permission given, but the only permission I have given is Glip and it's still in the red.
This should not be the case. Please contact the support team regarding this.
Finally, the test messages that I've sent, showing the user's actual name on the Glip App page. Is there a way that I can use an alias?
If you are posting using the credentials of a user, the user's name will show up since the user is being represented, not an app. You can also post into a team using a webhook or chatbot in which case other names will appear.
I am trying to integrate a Facebook news feed into a website using Facebook C# SDK https://github.com/facebook-csharp-sdk
var client = new FacebookClient("token");
dynamic me = client.Get("username/feed");
I have not been able to find any examples of generating an access token at runtime. All examples seem to be targeted at client apps where a used would be required to authorise the application.
Based on what I've seen so far, there used to be a way to generate a permanent access token (using offline_access permission), but as of 2nd May 2012 that approach is deprecated.
At the moment, I am not sure this is even a supported scenario.
Is it possible to get Facebook news feed entirely using server-side code with no user involvement?
EDIT: Looks like there might be a way: https://developers.facebook.com/roadmap/offline-access-removal/#extend_token
Will try later and report back.
no, you can't do anything with username/password. the user has to enter these into facebook's login ui and click the button to agree to letting your code do whatever it's asking to do.
I have an ASP.NET MVC 3 website which is available both from a specific public url, and I'm also making be available as a Facebook App.
Inside my website logic, in some places I have to determine whether the current request is from the Facebook-app, or from the public website, because I want to display content based on this environment.
So, for eg. if the user is using my site as a facebook-app, then I want to display a picture, and if the user is using my site normally, then I don't wanna display a picture.
To determine whether I'm from a Facebook app, I check the "signed_request" in the HttpContext.Request, and store it in the HttpSession to be available for my other actions, not just for that action (url) which is defined for my Facebook app.
So when a child-action is executed, I can determine based on the Session, that the website is used as a FB-app or not.
The problem happens, when the Session times out, because then althought the logic is still running inside Facebook, my logic thinks it's not inside Facebook.
Any advice?
Can you periodically contact the server from the FB-App? Maybe you can "ping" from it if the user does not make any action for a while
If you don't want it, you can store important information from signed_request in cookie, that expires when browser is closed. Session is not reliable enough to store this content.
I think your approach may be wrong. What if user enters your application both on Facebook and from separate url? Facebook has Javascript API, that places cookies if user is connected to the site. If user is connected, you should display Facebook related content and it shouldn't matter if this is canvas app or separate page. Specially if it uses the same views. If views are not the same, only url, you should have separate urls for canvas app.
Last solution, but horrible is to check in Javascript if page is working in iframe and if it is and signed_request is not present, reload top.location.
Right now, I have all the employees of my company login to an external website using the company id, username and a password. We are trying to integrate it into an intranet portal which should provide seamless access to this website without requiring the user to enter these credentials.
Is there any way of doing this programmatically (.NET C#)? Very similar to screenscraping, Can I simulate the appropriate POST action and then redirect the user to the logged in page?
Any help is appreciated.
Thanks.
You can make a <form> in your page that mirrors the external site's login form with the same action= attribute, then fill put and submit it using Javascript.
Note that this requires that you send the user's password to the browser, which is never a good idea.
You can certainly post to the external website, the tricky bit will come when you redirect the user there, because there'll be cookies restrictions I think.
You might be able to do something with Javascript that makes the Client browser post directly to the third party with the correct credentials, look into jQuery's Post command.
Assuming that the external website maintains sessions with cookies in some way, the problem is, your company website can't set a cookie, except from it's own domain, and the 3rd party website can't read cookies except from it's own domain, so you can't transfer or pass the cookie across to your users.
The name for this technique is Single Sign-On. There's no one way to do it, but the emerging standard is called SAML. This requires participation on both parts (the originator and target website), so it's probably beyond your current purview.
Like the other two answers have mentioned here, you can post a formatted request directly to the action of the login script, but I can tell you from experience that that solution will be brittle, that is, it will shatter the second the target website makes any changes.
Your best bet is to contact the administrator of the target website and ask if they have an SSO (Single Sign On) solution.
Here's a little bit about my situation:
I want to be able to retrieve a list of emails for the friends of a given user.
Here is how I would like the process to go:
A div box pops up with a login (used to log in to their facebook account, not my website's account system - that is separate)
Then once the user has entered their facebook credentials, they will have a button appear.
Send email to all friends.
If they click on this button I would like an email sent out to all of that user's friends.
Questions:
I only want to pull out emails from a user's friends, so...
1) Is it actually a facebook app that I'm creating?
Many of the tutorials talk about facebook apps and how you have to go to facebook and create an app from there and set all of these settings for page redirects and such. I didn't think I wanted it to be an app, all I want is the information.
2) If I do need it to be an app, how is it supposed to interact with my website? Some talk about iframes, or other methods... How am I supposed to know which to use and how I can integrate it into my site?
You have to create app through facebook, but it's only for autorization information.
api key
api secret
And you have to few options for working with facebook API from C#
Facebook Developer Toolkit
.NET Facebook API Client
Facebook.NET
Bemmu is correct = you can't use facebook to get email addresses.
You can send a facebook messages (which usually sends an email to the recipient as well depending on the users preferences).
You'll need to build a facebook app, and get users to allow it to access their profile information (default request). Then you'll be able to sendNotification to receipientID's.
Start with http://wiki.developers.facebook.com/index.php/Notifications.send and look at other references to the Stream API.
Do read the guidelines and agreements - there's rules on how long you can hold onto stream data and what you can use it for.
Let me add to that the PHP API:
http://wiki.developers.facebook.com/index.php/PHP
http://developers.facebook.com/get_started.php
There are no API methods to get anyone's e-mail addresses on Facebook, and neither are there on OpenSocial. This is so that the e-mail addresses do not end up on spam lists. There is a way to send e-mail without getting to know the actual addresses though. If you get the user to accept extended privileges for your app, then you can send e-mail at some reasonable intervals to that specific user.