Subscribers
We recommend using this API endpoint when you need to create or update a collection of subscribers at once.
post
https://app.bentonow.com
/api/v1/batch/subscribers
Batch Import
Below is a short example in Ruby on how you may want to utilize this import to add subscribers into the system. Whether you want to add 1 or many this endpoint should do the trick.
import.rb
# Find these under your account settings.
publishable_key = "XXXX-XXXX-XXXX-XXXX"
secret_key = "XXXX-XXXX-XXXX-XXXX"
# Find this under you site settings.
site_uuid = "XXXX-XXXX-XXXX-XXXX"
# You can send an array of subscribers.
# MAX 1000 per request.
# By default, Bento does a find and merge on all data.
# Use the command key to subscribe or unsubscribe users.
import_data = [
{ email: "[email protected]", name: "Jesse", customer_id: "123", tags: "customer,mql", remove_tags: "lead" },
{ email: "[email protected]", name: "Scott", customer_id: "124" },
{ email: "[email protected]", command: "unsubscribe" },
{ email: "[email protected]", command: "subscribe" }
]
uri = URI.parse("https://app.bentonow.com/api/v1/batch/subscribers")
request = Net::HTTP::Post.new(uri)
request.basic_auth(publishable_key, secret_key)
request.body = JSON.dump({site_uuid: site_uuid, subscribers: import_data })
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)
Last modified 7mo ago