forked from hellofresh/appboy-python-client
-
Notifications
You must be signed in to change notification settings - Fork 14
/
examples.py
36 lines (33 loc) · 865 Bytes
/
examples.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
from braze.client import BrazeClient
client = BrazeClient(api_key="YOUR_API_KEY")
# For create - update users
r = client.user_track(
attributes=[
{
"external_id": "1",
"first_name": "First name",
"last_name": "Last name",
"email": "[email protected]",
"status": "Active",
# And other fields ...
}
],
events=None, # if we don't want to send events we set it to None
purchases=None,
)
if r["success"]:
# do our magic here
print("Success!")
print(r)
else:
print(r["client_error"])
print(r["errors"])
# For delete users by external_id or appboy_id
r = client.user_delete(external_ids=["1"], braze_ids=None)
if r["success"]:
# do our magic here
print("Success!")
print(r)
else:
print(r["client_error"])
print(r["errors"])