πŸ“§
Broadcasts
This endpoint allows you to programmatically create and draft/send broadcasts via the API.
​
post
https://app.bentonow.com
/api/v1/batch/broadcasts
Batch Import
Important to note that the broadcasts parameter is an array meaning you can bulk upload upto 100 broadcasts in a single API call.
1
{
2
name: "Campaign #3",
3
subject: "Hello World",
4
content: "<p>Hi {{ visitor.first_name }}</p>",
5
type: "plain" // or "fancy" for full HTML control.
6
}
Copied!
Below is a short example in Ruby on how you may want to utilize this import to add broadcast 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: "Campaign #3: Plain Text", subject: "Hello World", content: "<p>Hi</p>", type: "plain" },
7
{ name: "Campaign #3: Full HTML", subject: "Hello World", content: "<p><strong>Hi</strong></p>", type: "fancy" },
8
]
9
​
10
uri = URI.parse("https://app.bentonow.com/api/v1/batch/broadcasts")
11
​
12
request = Net::HTTP::Post.new(uri)
13
request.basic_auth(publishable_key, secret_key)
14
request.body = JSON.dump({site_uuid: site_uuid, broadcasts: broadcasts })
15
request.content_type = "application/json"
16
req_options = { use_ssl: uri.scheme == "https", }
17
​
18
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
19
http.request(request)
20
end
21
​
22
puts JSON.parse(response.body)
Copied!
Copy link