Sha256: 363cab3deeb885bc17d57ce9d77705f9f4a2a3ac1d3e9e6f75dfb002a764e34b
Contents?: true
Size: 963 Bytes
Versions: 20
Compression:
Stored size: 963 Bytes
Contents
require 'net/http' namespace :bot do namespace :kik do desc "Update a bot config" task :configure do uri = URI.parse("https://api.kik.com/v1/config") bot_user = ENV['KIK_BOT_USER'] bot_token = ENV['KIK_TOKEN'] request = Net::HTTP::Post.new(uri.request_uri, initheader = { "Content-Type" => "application/json" }) request.basic_auth bot_user, bot_token request.body = { webhook: "#{ENV['CALLBACK_URL']}?bot_username=#{bot_user}", features: { manuallySendReadReceipts: false, receiveReadReceipts: false, receiveDeliveryReceipts: false, receiveIsTyping: false } }.to_json http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = (uri.scheme == "https") response = http.request(request) if response.code == "200" puts "Configured okay!" else puts "Error: #{response.body}" end end end end
Version data entries
20 entries across 20 versions & 1 rubygems