I've been trying for a while build some method to share information from my web page via the Whatsapp application.
I actually found an easy method to do it using this code:
Share via Whatsapp
And it works great, but i still don't find how to know if the user really shared the information, or just got back to the web page.
Is there a way to make this work?
Thanks.
It doesn't seem like you can. What's app doesn't seem to have an API much less analytics or webhooks.
The only way you could potentially do this would be to have it launch an iframe and inject javascript to track their interactions. This won't work because of cross domain security measures (think of the nasty things you could do if you weren't well intentioned). The iframe would need to be on the same domain as yours.
Related
I've managed to scrape websites that require no login using js only and a little help from websites that allow me to pass the CORS issues(like allorigins), but I just couldn't manage to get pass through the login problem.
I've seen many posts discussing of doing it using node.js and python beautifulsoup, but none on how to do it with javascript.
So how do I go about it?
Is it even possible doing it purely on client-side?
I'm willing to do all the learning and searching needed, but I need some direction in this vast subject.
Assuming you meant using in-browser JavaScript, how did you get around CORS? And if you did, then once the page refreshed after a successful login you code would stop running anyway unless you were a browser extension.
If you mean on your computer, then Node is what you're looking for, but unless you use a project like Headless Chrome then you'll run into the issue of saving the cookies between requests which is what keeps track of your session and actually keeps you logged in.
Login requires a direct interaction with your browser, like saving a cookie, returning a security token etc.
If you use JavaScript from a html page, it would theoretically require to visit the other page, at least inside a iFrame. There is a limit of how much you can do with javascript inside a iFrame.
With other words you try to imitate something like Selenium. Give it a try. It works with Java. You can control you browser, telling what to do, like a real user, and fetch the results, make even screenshots.
I am looking for a way to show Facebook engagement on from our website on our Facebook page. IE, when someone likes/shares etc. a page on the website, that that activity be reflected by our Facebook page in some way.
I was planning on using the graph API calls to do page updates, but the permissions are granted to users, not to the app itself, meaning this would only be possible for existing administrators, defeating the whole purpose (Perhaps a bit obvious in hindsight).
Is there a good, clean way of posting page likes/shares of our web pages to our Facebook page feed?
Notes:
I'm working in PHP and/or client side JS
A high volume of posts drowning our regular content is not likely at the moment, however, advice about how to manage such a beast in the long run might be helpful
If I understood correctly and want to share content from Facebook into your Website, the behavior you mention used to exist via the Activity Feed or Recommendations Feed. However, it has been deprecated since Graph API version 2.3.
If what you want is to update comments from people in your Website to your FB Page, you could implement something in your backend which listens to content uploaded and uses your Page Access Token to create custom stories using your user's data. As you mention, it won't happen in the name of people, but you could be creative and make the text narrate what people did on your website. Maybe even use OpenGraph for this.
I want to display the number of times a video has been viewed using the core reporting API via Javascript. However, the API is designed with OAuth, for building applications and not just logging into my account to get the event count.
Is there a way to login for just my account via Javascript?
Thanks,
Matthew.
I think what you are looking for is a Service account. To my knowledge you cant use a Service account with JavaScript due to security issues with the key file.
What you could try and do is to authenticate the script once using normal Oauth2 then save the refresh token to the file and hard code that into your script and send that. But I wouldn't recommend it as then anyone that checks your script will also be able to access it. So basically you have the same security issues you had with using a Service account.
As you can see doing what you are trying to do with JavaScript isn't really going to work. As you can see this is something I have also tried unsuccessfully in the past to do. I recommend you try and do this with some kind of server sided scripting language, like PHP.
Using javascript or flash, is it possible to log into websites and than pull content from that page?
I am trying to make a phone app that displays content from a site that requires log in.
To the extent that this is possible, it's almost certainly not a good idea. Your phone app then has brittle dependencies on the structure of the site from which you're pulling data, and you have no way except notification of failure to detect when those dependencies change.
Does the site from which you want to pull information provide an API? That would be a better solution.
Theoretically, yes, though depending on the browser, it may not allow cross-site scripting. The only way I can think of on a mobile site to do this is either with an ajax call to submit login credentials and grab data, or with an iframe. iframe would probably work better since ajax calls would probably not set the right cookies for session id maintenance. I dont know how elegant this solution would be.
I'm working on a web application where users will create accounts. Then clients will be about to have a section on their site for users to login with my sites login credentials. However... I don't want the clients site to be able to see or handle their login credentials. I am wanting to do cross domain authentication just like facebook connect does.
I have done research and it looks like I will need to create a javascript library that users will need to add into their site. Inside that javascript file I will need to create an iframe that will connect to my main site. From there a cookie will need to be placed then checked.
Does anyone know of well written tutorials on how to do this or could you explain in detail on what all will need to be done?
EDIT:
How would the storing and reading of cookies work. Anyone have examples?
The simplest way would be a plain iframe. Twitter does it a lot. If your have to communicate with the parent site for some reason, try building an API with the postMessage function.