I'm creating a telegram bot in ruby , right now I'm using long polling , but I wanna change to webhooks, but I'm only found information about creating webhooks in rails , so I don't know if is possible to set a webhook in a ruby only project.
Anyone did this? or have a tutorial? Maybe a lighter application in sinatra or rails api mode?
You could start with a simple socket server: https://ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/Socket.html
However, creating a Rails app with one route for the web hook will not take you a lot of time. This will also give you a lot of flexibility to do more with your inbound data and app in the future e.g. admin dashboard, security, background processing, etc.
Related
When I did research online, most of the solutions are about triggering Slack notification from TravisCI. Now I want to do the reverse direction - type some message in slack, and trigger a build task in TravisCI.
I'm looking at Slack's Outgoing WebHooks - under their "Custom Integrations" in Slack app directory. However, their webhook POST data spec is fixed, not seem to be programmable through just their webpage UI. They have a column in the UI that lets you fill in URL(s) to POST to. But I don't see any ways that I can customize the data field of the POST request.
Same as TravisCI's Triggering Builds API v3, the data fields they expect in the POST are fixed and unchangeable.
I know I can sign up a cloud service, write some code and spin up a server to re-package the parameters to do the work, like a middleware between these 2 APIs. But just want to see if anyone manages to achieve triggering TravisCI by Slack in such way that doesn't involve spinning up a server myself?
I ended up hosting a server and writing the porting logic myself. I guess there's no simple way to do this, after all they are different APIs. Here is the code where I request against travisCI API, and here is the code where I unpack the slack webhook POST request.
I’m building an iOS app that utilizes Uber’s API and Parse. After a user requests a ride in my app and the ride status changes, I’d like to update the in app screen and send a push notification. Uber’s docs say to use web hooks for this. I’m trying to figure out how I would do this if I’m using Parse. As far as I know, a Parse backend doesn’t have the ability to receive POST data from the Uber web hooks. I was thinking of making a small express server that would receive the web hooks POST data, clean it up, and send it to Parse’s API which would in turn send it to the client as a push notification. Is there a better way to do this?
I think you're on the right track. It looks like there are some projects in the Parse OpenSource Hub you could re-use for your purpose.
The alternative is to simply do a GET /v1/requests/current every few seconds within your app.
I am trying to figure out how to get chat working in the Smart Admin Theme
As I can see, the newer version ships with a Chat beta plugin. On the "About the API" page, it gives a few instructions on how to get the front end working but unfortunately has no information about the back end.
How do I go about implementing the back end for this chat? Do I purchase an account at CometChat. And even if I do, I am still confused about the implementation both on the back and the front end.
I mean do I listen to some events from CometChat, like from some web sockets and then check to see the new message and open a new window on the front end to display it there? Does it work like Pusher, maybe?
I terribly apologize for the vagueness of this question. It is just that I am confused about this and am not able to explain myself in well manner. Can somebody point me in the right direction on how to get the chat feature working if my back end web service is built using Laravel 5?
I am currently trying to use nodeJS with Socket.io. This guide will help you a long way: http://socket.io/get-started/chat/
The reason I chose for nodeJS with Socket.io, is that it's realtime. The use of sockets allows you to send messages from server to client, instead of making your client poll for new messages every x seconds.
With some JavaScript skills, you could easily make a nice chat application with person to person chat or even chatrooms.
I am in the middle of building a PhoneGap (Cordova) app which I would like to be able to talk to a Django site of mine. The steps needed to get the app working are:
Authenticate the user (stay logged-in across app restarts) (e.g. get session cookie from Django for communication with the service - where to store?). Note: The Django endpoint uses https.
When app receives push notification load some data from my django site.
Make selection on data and submit response back to my django site (will need the csrf token?)
I was able to sort out the push notifications but now I am wondering which solution would work best for the communication with Django.
As I understand there are two possible approaches:
Either to implement a REST service with something like tastypie or
try to setup the communication via ajax (e.g. jQuery)
At the moment I am thinking that going simply ajax might be the best approach since the app is fairly small and there are no additional requirement for a REST API.
It would be great if anyone could give me any pointers on how to solve this or share some experiece / code. Especially the steps of the authentication process are unclear to me.
I am not sure if this is still an open question but it is sure an interesting one.
I would strongly suggest on using the django-tastypie and you could start by using the docs which are indeed a great point of reference.
My experience until now has shown that I should always start by making my api clear(and rest) than choosing an easier faster solution(e.g. ajax) because if your app is a successful one, frameworks like tastypie help you scale.
The authentication process is pretty straightforward if you choose the basic one.
You just ask for the user credentials and there are many clients implementing the client side basic auth.
Fortunately, tastypie supports more than this. For example, the api authentication and you could read more here.
If you need anything else, please let me know.
Regards,
Michael.
I have two Apps, one in Ruby and other one in PHP (Assume, there is a different team developing this app).
Ideally what happens is; Other App sends request to Ruby App with some parameters, I want to store this Parameters in database on Ruby App's side. Then Ruby App picks up this parameters does some processing and saves data back in Database and again.
Now I want to send request to Other App with new parameters. How do I achieve this?
You write the Ruby app so it is run from a web server (I believe Ruby on Rails is still a popular way to do that in Ruby land) to get the requests, and then use an HTTP library (Google finds NET:HTTPSession) to make the requests back to the other service.