-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_event.php
More file actions
81 lines (73 loc) · 2.43 KB
/
batch_event.php
File metadata and controls
81 lines (73 loc) · 2.43 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
$accessToken = "ACCESS TOKEN";
$apiEndpoint = "https://pams.ai/xxxx/xxxx";
$data = [
"_use_first_contact_id_for_all_events" => true,
"events" => [
[
"event" => "lead",
"form_fields" => [
"_database" => "db-public",
"_skip_consent" => true,
"_redirect_id" => "123",
"affiliate" => "pam001",
"customer" => "cus001",
"firstname" => "John",
"lastname" => "Doe",
"email" => "john@pams.com",
"sms" => "0811111111",
"line" => "Uxxxx",
"utm_campaign" => ""
]
],
[
"event" => "allow_consent",
"form_fields" => [
"_database" => "db-demo",
"_consent_message_id" => "2d4yX.....fqjF0qeP",
"_version" => "latest",
"_allow_terms_and_conditions" => true,
"_allow_privacy_overview" => true,
"_allow_necessary_cookies" => true,
"_allow_preferences_cookies" => true,
"_allow_analytics_cookies" => true,
"_allow_marketing_cookies" => true,
"_allow_social_media_cookies" => true,
"customer" => "cus001"
]
],
[
"event" => "allow_consent",
"form_fields" => [
"_database" => "db-demo",
"_consent_message_id" => "2d4z4...GTUnluU2d",
"_version" => "latest",
"_allow_terms_and_conditions" => true,
"_allow_privacy_overview" => true,
"_allow_email" => true,
"_allow_sms" => true,
"_allow_line" => true,
"_allow_facebook_messenger" => true,
"_allow_push_notification" => true,
"customer" => "cus001"
]
]
]
];
$ch = curl_init($apiEndpoint);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: $accessToken",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
$responseData = json_decode($response, true);
print_r($responseData);
}
?>