Ionic/Angular/JS Create a click event to automate process - javascript

I am making an app that will preform several functions at once, the functions are sending an SMS and posting a message to Facebook and twitter
however, I have hit a wall, I can not find any information on how to automatically post to Facebook and Twitter and send an SMS.
I do not want the user to wait for the SMS messenger APP to open then tap send, then wait for Facebook to open then tap send and then wait for twitter to open and then tap send.
I want to send an SMS and Post to socials all at once.
is there any solution or advice for me and where to look.
I am using the IONIC shareSocials Plugin.

The only way would be via API integrations (but still..)
Remark: This would require the whole package..
Registering and setting up your app-clients for both FB and Twitter to allow integrating with their API's and allowing users to authenticate;
You'll need to implement the user authentication within your app to get their tokens after authenticating;
Handeling the auth-tokens in a secure way;
...
Below are the related API sections.
Twitter:
https://developer.twitter.com/en/docs/tweets/post-and-engage/overview
Facebook (only allows publishing to pages, not sure if there is still a way to post something to a user's feed):
https://developers.facebook.com/docs/graph-api/using-graph-api/#publishing
If you want SMS to be automated as well, you could look at SMS gateway API's, but these are not free (for large amounts) and are sending from a "general" number, not the user's number.
Example: https://gatewayapi.com/

If you will take a close look at those APIs you will see, that they return a page in response. This happens for a safety reason, this way they assure, that your data wasn't stolen. If the credentials are there, you go directly to the "message" view. But it is also another level of control, and posting without user interaction is a policy violation.
There was a way to post something without user interaction with opengraph, but now they are even more cautious about such things. That is also against their policy, which was recently renewed.

Related

Is there a way to perform a "Submit" function outside of the website?

I am trying to figure out if it is possible to click on a button on the Amazon website from outside of the website.
For Example: At the bottom of every product review is a "Helpful" button. If a review was helpful, the reader/shopper can click this button to let the reviewer (and Amazon) know that the review was helpful. (It's basically a "Like" button).
What I'm trying to accomplish:
I want to post my reviews on my own website/blog and still obtain "Likes" without asking readers to click a link to a product page, then search for my review, then click the button.
You probably won't be able to do what you have in mind.
JavaScript can generally access information on another domain except if specifically configured in the origin website through CORS. Unless you own amazon.com, you won't be able to configure amazon's CORS headers to make them accessible to some JS running on your website.
You can however, from your website front-end, make a request to your website back-end that would be able to access amazon's data just like your browser does. Using a browser emulator like Puppeteer, you'll be able to launch an amazon page and programmatically retrieve infos, click on things and do other stuff.
However, the page that Puppeteer will be able to spin up will include credentials (cookies, localstorage content, auth token, etc) provided by your server, so Puppeteer will not see the same amazon.com your user sees on his browser, unless your user agrees to give you its amazon credentials, and at this point I'm pretty sure no user would do that, and that would not be authorized by amazon's terms of services.
TL;DR even if what you have in mind is not impossible, it would weeks for your and your team to code a system that would potentially allow you to do that, and that's provided the law is on your side, which is probably not the case.

How do I track actions that the user takes on a different website?

I have seen websites such as google and facebook do this and I've done some search but honestly I'm not sure what I should be looking for.
When these websites send confirmation codes to your email in order to verify your account, sometimes the confirmation is triggered before you even enter the code. I've also seen it happening on mobile with confirmation codes being sent via SMS. As soon as the SMS is received, the app asking for the confirmation code detects it and accepts the confirmation without the user having to input the code.
How do these websites track what is happening on a different website/app?
The page that's waiting for the code usually is polling a service in some way. Common methods include Server-Sent Events and Web Sockets.
When the user becomes authorized through an action elsewhere, server-side, a message is sent indicating the waiting client to try again, now that authorization should be allowed.
In the SMS case, apps used to get read access to your messages and would be notified this way. This is less common now, due to privacy concerns.

Sending messages to google cloud pubsub topic from browser without authentication

I want to write a simple javascript plugin that can send pubsub messages from the browser. But because these clients may not be (or may not want to) log in, I would like to have the plugin be able to send pubsub message unauthenticated. Is that possible? If not, what would be the best way to achieve this.
The specific use case here is: writing an web analytics plugin that can track something like page load and other events.
Sending pub/sub messages would require one to be authenticated against the project where the topic was created. Your client logging into a Google account would not be relevant unless you planned to give every user of the page access to your project.
What you probably want to do is have a service running that is authenticated to publish messages. Requests from the browser would be sent unauthenticated to this service and then you could publish a message (after some verification that it is a legitimate message, I expect) into Google Cloud Pub/Sub.

Using Auth0 to authenticate through custom scenario?

I have an idea for a Minecraft plugin which will allow users to log into the website associated with the server without requiring registration, all they would require is their Minecraft username.
I'm trying to find the best way to get Auth0 to authenticate users through a custom passwordless strategy, instead of the default email or SMS which Auth0 provide.
The context which I'll be using this in is as follows:
Minecraft username is entered as their login on the site > Magic link is sent to their text box in-game through a custom plugin and listener > User clicks on the magic link and they are authenticated using Auth0 (JWT token for 30-ish days).
Does this sound possible? or is it wishful thinking.
I know I'll need a custom listener to look for requests from Auth0 and something to return the magic links to the user in-game through a java plugin.
I see no reason that it wouldn't be possible, but there are a few factors to take into consideration:
Minecraft chat cannot be assumed private and direct. There are chat logs and plugins that can intercept your messages. Passwordless auth is like communicating a one-time-use password, so why would you send it via insecure means?
If we assume it's secure, typically it's the responsibility of the user to store the JWTs. If this is a vanilla client, you have no method of storing data on the client, so in the end the server is managing JWTs, which kills the entire reason to use them. Otherwise, why not just have the listener add the player to, say, a cache that expires Players after 30 days of not being accessed?
Other than these two kinks that can be worked out, it sounds like a cool idea. Good luck with it!

Single page application with login and search robots

In my work with a Javascript single page application, i have recently run into a problem.
The whole idea behind this project, is to avoid page reload. When the user comes to my application they won't need to make any reloads. This is done with jQuery and Backbone.js and PHP as service.
I have this static index.html file, where i hide my login container and application container. Then i show the login container, if the user is not recognize by my application, and if they have auth i show the application.
if auth:
application.show()
elif not auth:
login.show() // like Gmail or Facebook etc.: Information + login-form
I wan't to show users who aren't authenticated, both login-form and general info. Very important is also that the site can be found by robots as Google etc.
Can this only be done with 2 different files, giving me reload? A site.com and login.site.com. That solution irritates me, because my login, as it is by now, is quite instant.
Not sure I get the question completely but if you want to check if a user in authenticated, try to do an ajax call. If it fails with "401 unauthorized" the user needs to login...
You can achieve what you want by using ajax calls to authenticate (Although this is not a recommended approach, and people usually prefer the two page solution you have outlined).
What you can do, is have very skinny controllers that just exist to provide data to rich client UI.
Your gateway controller(A separate controller, with no model that acts as an entry point in the application) will just render the basic application structure to the client (without any user specific data, you dont know if the user is logged in, you dont need to know at this point). Then the client will query the UserController for identity of currently logged in user, if user is logged in server returns a json response containing information related to user and if not, server returns a response saying that user is not logged in. Then you can fetch a partial for the login form and then submit it again through ajax. As you see, creating the UI once and communicating with the server with lightweight ajax calls can solve your issue easily.

Categories

Resources