Sending SMS using Way2sms on rails - ruby-on-rails

Can any one help me to send sms using way2sms api by means of rails application.
Thanks

I have created a free open source SMS API called AlfaSMS API for way2sms,160by2.com,fullonsms. It is available in many programming languages like PHP,VB,C++,c#,Python etc.You can download it from http://www.alfredfrancis.in/alfasms-api/

I have developed an API that anyone can use. Check it out here.
You can use the web page I created or you can use the API. For example, your application can directly forward the request to:
http://ubaid.tk/sms/sms.aspx?uid=99999xxxxx&pwd=12345&msg=YOUR_SMS_MESSAGE&phone=9996669990&provider=way2sms
The different providers are way2sms, fullonsms, smsinside and tezsms.
Works 100%, all the time. :)
Edit: As of 2014, the service is stopped since it violates the TOS of most of these providers.
Cheers.

There is a ruby gem that I wrote based on Ubaid's API. You can find it here.
You can use it in any ruby or rails project as long as you are running a version of ruby >= 1.9.
require 'chagol'
texter = Chagol::SmsSender("9876543210","password","way2sms")
texter.send("9968154700", "Chagol Rocks")
Disclaimer, I am the author of this gem.

Related

Ruby - Google Analytics 4, where is the view_id?

So i have a project where i use 'google/apis/analytics_v3' to make some requests and get some data, the thing is that i need a view_id to do that.
#service.get_ga_data(VIEW_ID, #start_date, #end_date, 'ga:users').totals_for_all_results
the thing is that, on the new version of the analytics we don't have the view_id and i cannot find a way in ruby to do the same that this does.
Someone knows how to migrate to GA4 in ruby on rails, i can't find much documentation. We are talking about server side requests to google.
Thanks in advance to someone who can help me
I went over the GA4 configs trying to find the view_id, i've seen that this will be deprecated.
I've tried find other gems to make the requests and the authentication
Went to the github of the gem to check for updates.
Couldn't find a way
The 'google/apis/analytics_v3' library is for use with Universal analytics and requires a view id.
You need to use the Google analytics data api to access google analytics ga4 accounts.
require "google/analytics/data"
Google::Analytics::Data.configure do |config|
config.credentials = "path/to/keyfile.json"
end
client = Google::Analytics::Data.analytics_data

Use Tweepy to extract Twitter follower information (API incompatibility issues)?

I was following this tutorial, https://towardsdatascience.com/how-to-download-twitter-friends-or-followers-for-free-b9d5ac23812, which was written in 2021. It should've worked fine, however, they have to 'fix' the things that just work.
Specifically, running this line
for fid in Cursor(api.followers_ids, screen_name=screen_name, count=5000).items():
ids.append(fid)
gives the error:
"tweepy.error.TweepError: [{'message': 'You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve', 'code': 453}]"
I could have pulled the data in five minutes. Now debugging this already cost one hour+ because they just break the things that work. Is there anyway to make this old code snippet work? The application to use API 1.1 takes weeks, and I don't have time to watch their bad documents of how to migrate from API 1.1 to 2.0 and then the documents of migrating from Tweepy 3.9.0 to 4.0.0. Five minutes' task would just become half a day. Thanks in advance for any help.
First of all, have you at least tried to apply for the Elevated access?
It can take some time, it's true, but it can also be instantaneous.
The other solution would be to use the Twitter API V2.
You don't need any tutorial, just read the documentation:
Here for the authentication ;
Here for the retrieval of the followers ;
Here for the pagination.
And you should get something like that:
import tweepy
client = tweepy.Client("Bearer Token here")
paginator = tweepy.Paginator(
client.get_users_followers,
id=..., # ID only, no screename
max_results=1000
).flatten()
for follower in paginator:
print(follower.id)
Finally, even if I understand your frustration (and developing Twitter applications can be very frustrating), I think that you should try to keep it out your SO questions. Good luck!

Using Activestorage (direct uploads) via API

I'd like to use Rails as a backend to a mobile app (Android and maybe iOS), and one of the requirements is file upload.
I haven't been able to find any resources on using Activestorage with direct upload in this way – does anyone have an example or tips?
The alternative – I suppose – is to reverse-engineer activestorage.js and do exactly what it does. But perhaps I'm not the first one with this need...
Rails does not care if your data is sent from a mobile-app, html-form, react-app, server-to-server...
If you can authenticate the request and send a multi-part file, then you do active-storage from your app.
Probably smart to look at gems/apps that do this already https://github.com/cbothner/react-activestorage-provider

Ruby on Rails i18n problem

I have a site created by Ruby on Rails. Before I implement HTTP_ACCEPT_LANGUAGE to detect the client's computer language and set the site's language with i18n, the site can be found on Google.
After I use HTTP_ACCEPT_LANGUAGE and i18n, Google stop crawling my site. And worst, some countries receives Read Time Out Error when going to my site.
What is the problem? (using GeoIP is not preferably, detecting the client's computer language is more meaningful)
Apparently HTTP_ACCEPT_LANGUAGE is not available to Google bot. See this article for reference.
As #picardo has said, Google bot crawles the web without sending the HTTP_ACCEPT_LANGUAGE header. I've implemented a Rails gem to automatically set the I18n.locale based on this header, but then fall back to guessing based on the domain name suffix, so that it still detects correct language for Google bot. The gem is called locale_detector.

Ajax Push Engine

are there anyone hear about APE (Ajax Push Engine) before ? I'm building Rails application and trying to create group chat with this APE realtime engine, the problem is how to make Rails communicate with APE Server ? Are there any tutorial or reference on working APE with Rails ?
As far as I know, Mike's answer is not entirely correct.
For clients all clients the receiving part, in all scenarions, this is 100% correct: The communication is done by Javascript.
Also, the javascript can (and in many cases will be the best choice) be the most reasonable choice to push the info to the server too. This is the case with open communications of many to many people like in chat rooms.
However the following documentation page states clearly that we have other choices:
"Using inlinepush module to push data
from your php/rails/python/...
application to APE"
http://www.ape-project.org/wiki/index.php/Tutorial:How_to_write_an_application_with_APE
There are many cases that this could and should be so. I can think of at least 2 scenarios:
Applications that only logged in users could post things to others. Your app would handle the login and inline push info to the ape server.
Applications that broadcast live information from one source to many clients (in this case only the admin could post and this configuration is done on the server side also.
Let me note that I'm not using APE yet, I'm researching it and if I find I've posted any misleading info here, I'll come back and correct myself.
The short answer is that "you don't" APE works with Javascript calls back to the APE server (typically proxied through Apache or whatever server you're using).
Conceptually, if you wanted to break out into different "rooms" or whatever, you'd setup defaults within the javascript from the rails settings.

Resources