Configuring your server for webhooks
Learn how to set up a server to manage incoming webhook payloads.
Writing the server
require 'sinatra'
require 'json'
post '/payload' do
push = JSON.parse(request.body.read)
puts "I got some JSON: #{push.inspect}"
end$ ruby server.rb$ ruby server.rb
== Sinatra (v2.0.8.1) has taken the stage on 4567 for development with backup from Puma
Puma starting in single mode...
* Puma version: 5.5.2 (ruby 2.6.6-p146) ("Zawgyi")
* Min threads: 0
* Max threads: 5
* Environment: development
* PID: 819
* Listening on http://127.0.0.1:4567
* Listening on http://[::1]:4567
Use Ctrl-C to stop
> I got some JSON: {"word_count"=>100, "title"=>"...Last updated
Was this helpful?