I would like to implement notifications through WhatsApp API into my app. I've done lots of research but I couldn't find anything official.
Officially WhatsApp API Bussiness exists, but it is a beta version and only for companies that send massive volume of messages (1 million+). There is also Twilio, it requires a business approval and I got denied because (again) my volume requirement isn't into the millions of messages per month.
Unofficial libraries exist that potentially could get the job done. I looked into it and the one that I was contemplating seemed to be unreliable. But is this really the only way?
Since the start of pandemic I've been receiving all sorts of ads with apps that offer WhatsApp notification for orders and customer services... how are they doing it? I know they are small businesses, so there must be a way.
My app was built using JavaScript/React, any information is appreciated.
I think what you need is this-
These provide APIs that you can use in your App.
Moreover WhatsApp will terminate your account if you use tools other than officials ones.
I haven't tried this, but have used this for other web related tasks. Since WebWhatsApp runs in the browser on a PC, a VERY hacky way of doing this might (using a normal account) be as follows:
Web WhatsApp on the browser.
Selenium plug-in for the browser.
Java/C# or other programming language with Selenium libraries.
Then:
Record a macro in Selenium of your typical WhatsApp message (Search for contact, select contact, type message, send).
Manipulate the macro in C#/Java.
For anyone with time it's worth a try.
Related
First off sorry if this question is a 'bad' one; I am very new to the world of web apps, API's and Javascript.
As the title says I am trying to get a user's steamID using the Steam API using javascript.
This is for a web app that needs to get information about the games a user plays. (Which from my understanding is only obtainable using this special ID.)
My initial thoughts on how to do this would be to use openID so that the user gives Steam their info and the ID is returned to my app.
I have seen that there are lots of examples of this using php; however, because of project requirements, everything must be run in the browser. There is no backend server to even run php on so it is not an option what so ever.
I have spent a better part of a day trying to figure this out and have made no real progress, everything seems to lead back to using php. (maybe what I need under my requirements is not possible?) So an example or anything really would be much appreciated.
welcome to Stack Overflow I can see you are confused as to where to start or progress so here is a basic roadmap:
You will need to contact Steam to get an API key first.
Next part is more tricky for a beginner. You will need to get node.js which is a package manager. Effectively it's a large library of javascript programs which you can import into your own program to do things with. One of these so called "packages" is openid-client, which is an implementation of openID that you can add to your site. Users click on the openID button on your site, it redirects them to steam servers, they login, then your site gets their info without leaking their username or password to you.
Now that you have both the steamID and your API Key your program can input these two into the url steam provides to get owned games. You can input this completed url into fetch or axios (another node package that can request data from servers) and it will respond with the user's owned games in json format.
Here are a list of resources in order to get you started:
https://steamcommunity.com/dev
https://nodejs.org/en/
https://www.npmjs.com/package/openid-client
https://www.npmjs.com/package/node-fetch OR https://www.npmjs.com/package/axios
https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29
I suggest reading the documentation in each of these links and seeing if there is any youtube tutorials that try and do what you are doing with these technologies to help you implement them as a newbie. Overall there is a lot to learn on each of these technologies but as long as you orient yourself using guides or tutorials you will succeed. Good luck.
Check out this page: How to retrieve Steam username using SteamWorks API?.
However, it seems like an issue you might be having is connecting to the actual API. What exactly are you using for testing?
I know from experience, for example, that you can connect using Postman to various API's, and format a request for them in a chosen language, including JS>
I'm wondering if it is possible to track location while a Webapp is backgrounded?
I've heard this functionality is in the pipeline for service workers, though I can't find any literature on exactly how to do it.
It would be fine to just save the location on the phone until the phone is unlocked and then send location data over a network when the user re-opens the browser/tab.
If it isn't possible with purely Web technologies, what would be the best way to do this. Could one build a native app to handle tracking capability and still have a Web interface as the main UI?
A bit of context
I'm developing an app for a charity that allows users to track themselves when out and about etc.. The users are likely to lock their phones when on patrol so I need to account for this. I've built the majority of the app as a Webapp and it would be an big (and boring) task to rewrite it as a native android and apple app!
No, it is not possible for privacy reasons. You also cannot do any sort of accurate scheduling via the Service Workers when the app is in the background, eg. use setTimeout or so (throttled by the browser).
You've probably read about the background sync API which allows you to ask the Service Worker to submit some data when a connection is available. With this API you can implement retry for form POSTs and stuff like that but not have the location tracked. Find out more here: https://davidwalsh.name/background-sync
I am working with a research group that needs to collect Facebook post data for a group of participants over the course of a few months. The goal is let the participants authorize us to collect this information via facebook, and when they post to Facebook, send that information to a secured server.
After reading the Facebook documentation, I'm mostly just confused about how to provide a mechanism for the user to agree to the terms of collecting his/her data. I'm planning on using webhooks to collect the data, which is independent of the client platform, but do I really need to build separate apps for web, iOS and Android just for the approval process?
I'm planning on using webhooks to collect the data, which is independent of the client platform, but do I really need to build separate apps for web, iOS and Android just for the approval process?
You most likely won't get this approved in review anyway.
Permissions must, for the most part, be used to provide a direct benefit to the in-app user experience; collecting data for analytical measures only is explicitly mentioned as a not allowed use case. Whether the users would agree is not relevant here.
For example, user_posts permission, has "non-visible use of this data such as sentiment analysis or guarding against spam bots" marked with a red "X" for nope.
So the only way of getting your app to request the necessary permission(s) from users, would be to add them as testers to the app via app dashboard/API. Anyone with a role in the app which can be asked for any permission, reviewed or not. Those users would however have to have their accounts verified (mobile/text, credit card) and sign up as a "developer" on the FB platform, before your app could send them requests to become testers.
You'd be flying under the radar with that, so to speak. Facebook offers this "loophole" mainly for the purpose of letting developers test and develop their apps properly, before review. It is also explicitly mentioned in the app development FAQ as a way around the need for review, for specific use cases such as wanting to get your blog posts published to your own FB page automatically. It would not cover what you are trying to do so, but it will likely "work" as long as none of your test users specifically raises a complaint with Facebook ...
Not sure if there is any published limit on the number of test users that can be added to an app, people have asked about that in the past, but AFAIK none is documented or otherwise published by Facebook. If there is one, and it is not completely stopping this approach dead in it's tracks (say, a few hundred per app rather than, five), you could use multiple app ids, if you don't need to relate data between user accounts too much - because the app-scoped user ids will be different per app id, so that could making connections between friends that are in different "app-id test groups" etc. difficult. Or you might have to refer to other, less reliable measures of uniquely identifying them, such as email or profile name.
I'm a teacher. My grade book is a .xlsm file, located in my Google Drive folder. I'm building a web app, also in my Drive folder, that shows the students names arranged according to the seating chart. I want to run the app on my Android phone, and click a student's name to add a participation mark to the grade book. The app should also display the students' existing participation scores (from the grade book). What is the best way to go about accomplishing something like this?
*I initially tried to do this using another .xlsm file but, when I realized that macros don't run on the Android version of Excel, I switched to an HTML-based app. Was that the right decision?
Here is a sample .xlsm file. In this case, the app would check cell A2 to make sure it's the correct student and then both read and write to cell B2.
If Excel isn’t doing it for you on Android then I’d strongly suggest looking in to Google Sheets. Creating an app for this yourself would be a fun project, if you enjoy that sort of thing, but Google Sheets sounds like it might do the job and you can be up and running in a few minutes.
Having got that out of the way I think it would be best to clear up how web apps work, it sounds like you have some confusion about how they work (or I am from your question!).
A web app is typically made up of two parts, a client and a server.
The client requests resources from the server and the server responds. For example, the client requests the resource associated with example.com, the server is listening for this request and fulfils it by returning a string of text with some meta saying its html. The client (lets say its a browser) understands this is html and begins to parse and render it. If it hits <link> or <script> (or some other stuff) it knows to go and request more resources from a server.
The client is totally detached from the server, it has limited access to the file system and must perform tasks by asking the server to do them. It can only ask, not enforce.
Often there is a 3rd piece which is storage of some sort, this could be a file system somewhere or a database. The client is also detached from this and the server (or another service) owns and manages the storage. In your case Google Drive can act as your storage.
A web client has no direct access to your Google Drive, although if its contents is public there is likely a scheme for you to get a resource (I don't know how Google Drive works but this is fairly likely). I'm not sure it will let you write to the Drive though, not without additional permissions (granted through authentication) being acquired. Many popular frameworks and libraries will allow you to interface with Google Drive and handle the auth handshake etc etc, they are often called a driver or connector.
Very basically, you'd likely need a couple of parts:
Storage -> Connector -> Service -> Client
You can get away with putting connector and service together, and you might be able to get away with connecting direct from the client, which would save you the trouble of creating, hosting and running a service.
The last piece of the puzzle is the conversion you must do from the .xls data into something JS on the client can work with (again, there are often multiple ways of doing things, you might decide to render your page on the server).
There are many tools out there that can convert from .xls to json, which JS can then parse and use (on client or server). I have used one a couple of times but I can't remember which one right now, a quick npm search throws up a number of hits.
Your best option is not to use Google Drive at all. If you are interested in doing something like you described, I would strongly recommend using either PHP and MySQL (a popular combination) or Google Cloud Platform's App Engine (they provide a lot of help, even allowing you to easily build an app that you can sign in to from your Android device with your Google account). If you're more in the mood for Do-It-Yourself, I would probably recommend Spring Boot (These tutorials look pretty good)
When it comes to integrating with Google Drive, it is technically possible to do, but so difficult that you would be much better off writing your own system from scratch and perhaps exporting to an Excel file. (See this page for a tutorial on exporting to Excel from Java)
You have several concerns with the final solution for your problem:
Security (You don't want students breaking into it, like I probably would have done)
Accessibility (You want to get at the information on your phone and your computer)
If I was in your position, I would probably write a Spring Boot application (which can house it's own database, website and API for a computer/phone to communicate with) and an Android application that talks to it.
Also, it would be helpful to know what programming languages and/or libraries/frameworks you have used in the past in order to make better recommendations for your situation. What have you used in the past?
If you need help or have questions, just message or comment.
I want to get all of my facebook friends every day and I was searching which is the more efficient way to do it.
My first approach was to create a selenium webdriver script. It opens a web browser, visits /me/friends, scrolls down automatically until the list finishes and then it parses the names. It is working pretty good but it takes some time (approximately 4-5 minutes).
After some search on the graph API, it appears that it isn't possible to have your complete list.
Another approach is to request from facebook to download all of your data, but facebook sends you an email and you need to wait and download it etc. and still you have to wait.
Final approach was to use a chrome extension (the name is who deleted me) which it worked and it was faster than my approach. I am wondering how this extension worked and one thing that I noticed is that it didn't found a friend of mine which has passed away. I don't like a 3rd party extension to have my data and I prefer to do it on my own. So I am wondering is there an endpoint which returns your public friends? or what is the approach of this chrome extension to do that?
Is there any other programming way of fetching your friends? Sure you could use a headless browser and do some requests to the /me/friends and get the responses as it does a web browser when it scrolls down, but it is pretty difficult to understand which ajax calls are the correct ones.
Update:
My approach of scrapping: https://gist.github.com/johndel/cd01a854e8bf36d9d30b44758607cf3d#file-check_friends-rb
It isn't the best code I can write, just a hack for seeing it done, just replace the sendkeys with your email / password and it will do the trick. My approach gets all of my friends (the chrome extension approach didn't found a friend of mine, that's why I think it is hitting another endpoint and it is doing it differently).
/me/friends is a Graph API endpoint that will only get your a list of friends who authorized your App. It is not possible at all to get friends who did not authorize your App. Everything that WOULD be possible is not allowed on Facebook, because it involves scraping.
Scraping Terms: https://www.facebook.com/apps/site_scraping_tos_terms.php
More information: Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app
I found another url where I can fetch the users and it seems there are a bunch of them and more than one solution. So, a headless and faster approach is this gist:
https://gist.github.com/johndel/29afec4b159203baf7521cd5a50dbb60 and I guess it can be optimized even further with threads (maybe typhoeus and hydra).