Add subscriber to a group
Adds one or more subscribers to the specified group.
Endpoint
Section titled “Endpoint”HTTP method: POST
https://api.sender.net/v2/subscribers/groups/{groupId}
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
groupId | string required | Provide the group id |
subscribers | array required | Array of email addresses that would be added to this group. |
conditions | string | Will be selecting all the subscribers at once. Won’t work when sending together [subscribers] parameter. |
trigger_automation | boolean | This property by default its true. You ca send it as false if you want not to activate an automation. |
Request Examples
Section titled “Request Examples”const url = new URL("https://api.sender.net/v2/subscribers/groups/{groupId}");
let headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",};
let bodyContent = { "trigger_automation": false};
fetch(url, { method: "POST", headers, body: JSON.stringify(bodyContent)}).then(response => response.json()).then(data => console.log(data)).catch(error => console.error('Error:', error));$client = new \GuzzleHttp\Client();
$json = [ "trigger_automation" => false];
$response = $client->post( 'https://api.sender.net/v2/subscribers/groups/{groupId}', [ 'headers' => [ 'Authorization' => 'Bearer [your-token]', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'json' => $json ]);
$body = $response->getBody()->getContents();$data = json_decode($body, true);print_r($data);import requestsimport json
url = "https://api.sender.net/v2/subscribers/groups/{groupId}"
headers = { "Authorization": "Bearer [your-token]", "Content-Type": "application/json", "Accept": "application/json",}
payload = { "trigger_automation": false}
response = requests.request('POST', url, headers=headers, json=payload)
print(response.json())curl -X POST \"https://api.sender.net/v2/subscribers/groups/{groupId}" \-H "Authorization: Bearer [your-token]" \-H "Content-Type: application/json" \-H "Accept: application/json" \Response
Section titled “Response”{ "success": true, "message": { "subscribers_added_to_group": [ ], "non_existing_subscribers": [ ] }}