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.
{
name: "Campaign #3",
subject: "Hello World",
content: "<p>Hi {{ visitor.first_name }}</p>",
type: "plain" // or "fancy" for full HTML control.
// [OPTIONAL] the following is optional and not required to create a broadcast but handy to have up your sleeve if you need it.
from: { email: "[email protected]" } // requires both email and name.
include_tags: "lead,mql" // comma seperated.
exclude_tags: "customers" // comma seperated.
}
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
publishable_key = "XXXX-XXXX-XXXX-XXXX"
secret_key = "XXXX-XXXX-XXXX-XXXX"
site_uuid = "XXXX-XXXX-XXXX-XXXX"
broadcasts = [
{ name: "Campaign #3: Plain Text", subject: "Hello World", content: "<p>Hi</p>", type: "plain",from: { email: "[email protected]" }, inclusive_tags: "lead,mql", exclusive_tags: "customers" },
{ name: "Campaign #3: Full HTML", subject: "Hello World", content: "<p><strong>Hi</strong></p>", type: "fancy" },
]
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