Layouts
This endpoint allows you to programmatically create layouts via the API. Good for pushing templates from other sources and design tools.
post
https://app.bentonow.com
/api/v1/batch/broadcasts
Batch Import
Important to note that the layouts parameter is an array meaning you can bulk upload upto 100 layouts in a single API call.
{
name: "Onboarding Email",
css: "body {}",
html: "<p>Hi {{ visitor.first_name }}</p>"
}
Below is a short example in Ruby on how you may want to utilize this import to add layouts into the system. Whether you want to add 1 or many this endpoint should do the trick.
batch_importer.rb
publishable_key = "XXXX-XXXX-XXXX-XXXX"
secret_key = "XXXX-XXXX-XXXX-XXXX"
site_uuid = "XXXX-XXXX-XXXX-XXXX"
broadcasts = [{
name: "Onboarding Email",
css: "body {}",
html: "<p>Hi {{ visitor.first_name }}</p>"
}]
uri = URI.parse("https://app.bentonow.com/api/v1/batch/broadcasts")
request = Net::HTTP::Post.new(uri)
request.basic_auth(publishable_key, secret_key)
request.body = JSON.dump({site_uuid: site_uuid, broadcasts: broadcasts })
request.content_type = "application/json"
req_options = { use_ssl: uri.scheme == "https", }
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
puts JSON.parse(response.body)
Copy link