πŸ“§
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.
1
{
2
name: "Onboarding Email",
3
css: "body {}",
4
html: "<p>Hi {{ visitor.first_name }}</p>"
5
}
Copied!
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
1
publishable_key = "XXXX-XXXX-XXXX-XXXX"
2
secret_key = "XXXX-XXXX-XXXX-XXXX"
3
site_uuid = "XXXX-XXXX-XXXX-XXXX"
4
5
broadcasts = [{
6
name: "Onboarding Email",
7
css: "body {}",
8
html: "<p>Hi {{ visitor.first_name }}</p>"
9
}]
10
​
11
uri = URI.parse("https://app.bentonow.com/api/v1/batch/broadcasts")
12
​
13
request = Net::HTTP::Post.new(uri)
14
request.basic_auth(publishable_key, secret_key)
15
request.body = JSON.dump({site_uuid: site_uuid, broadcasts: broadcasts })
16
request.content_type = "application/json"
17
req_options = { use_ssl: uri.scheme == "https", }
18
​
19
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
20
http.request(request)
21
end
22
​
23
puts JSON.parse(response.body)
Copied!
Copy link