-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbulk-send.sh
More file actions
47 lines (43 loc) · 1.31 KB
/
Copy pathbulk-send.sh
File metadata and controls
47 lines (43 loc) · 1.31 KB
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
40
41
42
43
44
45
46
47
#!/bin/bash
# Send postcards to multiple recipients via the bulk API
# Usage: POSTCARDBOT_API_KEY=pk_live_your_key bash bulk-send.sh
if [ -z "$POSTCARDBOT_API_KEY" ]; then
echo "Set POSTCARDBOT_API_KEY environment variable"
exit 1
fi
BASE_URL="${POSTCARDBOT_API_URL:-https://postcard.bot}"
curl -s -X POST "$BASE_URL/api/v1/postcards/bulk" \
-H "Authorization: Bearer $POSTCARDBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"recipients": [
{
"name": "Jane Doe",
"address_line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"zip": "94102",
"country": "US"
},
{
"name": "Bob Wilson",
"address_line1": "789 Pine Rd",
"city": "Los Angeles",
"state": "CA",
"zip": "90001",
"country": "US"
}
],
"from": {
"name": "Your Business Name",
"address_line1": "456 Oak Ave",
"city": "New York",
"state": "NY",
"zip": "10001"
},
"message": "Hi {{name}}, thank you for being a valued customer!",
"image_url": "https://images.unsplash.com/photo-1501594907352-04cda38ebc29?w=1875"
}' | python3 -m json.tool 2>/dev/null || cat
echo ""
echo "Cards are processed in background batches (~25/minute)."
echo "Use check-balance.sh to verify your balance."