import org.json.JSONObject;
import suprsend.Suprsend;
import suprsend.SuprsendAPIException;
import suprsend.SubscriberListBroadcast;
import suprsend.SuprsendValidationError;
public class Lists {
public static void main(String[] args) throws Exception {
broadcast();
}
private static Subscriber broadcast() throws SuprsendException {
Suprsend suprsendClient = new Suprsend("_workspace_key_", "_workspace_secret_");
// Create broadcast body
String listId = "_list_id_";
String templateSlug = "_template_slug_";
String notifCategory = "_preference_category_";
//Optional Fields
//String delay = "30";
//String triggerAt = "2023-03-06T18:56:51.643Z";
//ArrayList<String> channels = new ArrayList<>(Arrays.asList("androidpush","email"));
//String idempKey = "__unique_id_of_the_request__";
//String tenantId = "__tenant_id__";
JSONObject body = new JSONObject().put("list_id",listId)
.put("template",templateSlug)
.put("notification_category",notifCategory)
.put("data", new JSONObject()
.put("link_suffix", "https://s3.amazonaws.com/unroll-images-production/projects%2F22692%2F1630591176038-322170")
.put("first_name", "Joe"))
SubscriberListBroadcast broadcastIns = new SubscriberListBroadcast(body);
// Broadcast with idempotency key and brand id
// SubscriberListBroadcast broadcastIns = new SubscriberListBroadcast(body, idempKey, tenantId);
JSONObject res = suprClient.subscriberLists.broadcast(broadcastIns);
System.out.println(res);
}