mirror of
https://github.com/System-End/shipment-viewer.git
synced 2026-04-20 00:25:20 +00:00
20 lines
No EOL
544 B
Ruby
20 lines
No EOL
544 B
Ruby
require 'faraday'
|
|
|
|
def loops_send_transactional(email, transactionalId, dataVariables)
|
|
raise "no løøps API key" unless ENV['LOOPS_API_KEY']
|
|
|
|
conn = Faraday.new(url: "https://app.loops.so/") do |f|
|
|
f.request :json
|
|
f.response :raise_error
|
|
end
|
|
|
|
conn.post('https://app.loops.so/api/v1/transactional') do |req|
|
|
req.headers['Authorization'] = "Bearer #{ENV['LOOPS_API_KEY']}"
|
|
req.headers['Content-Type'] = 'application/json'
|
|
req.body = {
|
|
email:,
|
|
transactionalId:,
|
|
dataVariables:
|
|
}.to_json
|
|
end
|
|
end |