Sha256: 5da14933b6f719b0a3fc7c902f7227ca5833eac30522fc03e1a2ade1b0d9fb78
Contents?: true
Size: 927 Bytes
Versions: 11
Compression:
Stored size: 927 Bytes
Contents
# frozen_string_literal: true require "telnyx" require_relative "options" require "sinatra/base" require "json" require "amazing_print" require "uri" class WebhookServer < Sinatra::Base set :port, 9090 def initialize super Thread.new { telnyx_setup } end def telnyx_setup @fax_application = Telnyx::FaxApplication.retrieve CONFIG.fax_app_id @fax_application.webhook_event_url = CONFIG.webhook_url @fax_application.save puts "## Fax Send Request ##" ap @sent_fax = Telnyx::Fax.create( connection_id: CONFIG["outbound_connection_id"], media_url: CONFIG.document_url, to: CONFIG.to, from: CONFIG.from, outbound_voice_profile_id: CONFIG.outbound_voice_profile_id ) end # Receive webhooks post "/*" do hook = JSON.parse(request.body.read, symbolize_names: true) puts "## Received Webhook ##" ap hook 200 end end WebhookServer.run!
Version data entries
11 entries across 11 versions & 1 rubygems