-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.py
executable file
·39 lines (33 loc) · 1.06 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
import requests
import csv
# Define the API endpoint and headers
url = "https://api.sender.net/v2/subscribers"
headers = {
"Authorization": "ASK SHIVEN",
"Content-Type": "application/json",
"Accept": "application/json",
}
# Define the group ID
group_id = "axVjkz"
# List of subscribers
subscribers = [
#Add your subscribers here in the format below
#{"First Name": "John", "Last Name": "Doe", "Email": "[email protected]"},
]
# Function to send subscriber data
def send_subscriber_data(subscriber):
payload = {
"email": subscriber["Email"],
"firstname": subscriber["First Name"],
"lastname": subscriber["Last Name"],
"groups": [group_id],
"trigger_automation": True
}
response = requests.post(url, headers=headers, json=payload)
return response.json()
# Iterate over subscribers and send data
for subscriber in subscribers:
print(f"Sending data for {subscriber['First Name']} {subscriber['Last Name']}...")
result = send_subscriber_data(subscriber)
print(result)