-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_sms.php
More file actions
44 lines (34 loc) · 1.46 KB
/
send_sms.php
File metadata and controls
44 lines (34 loc) · 1.46 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
<?php
require 'vendor/autoload.php';
use CloudContactAI\CCAI\CCAI;
use CloudContactAI\CCAI\SMS\Account;
// Initialize the client
$ccai = new CCAI([
'clientId' => '2682',
'apiKey' => 'eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJpbmZvQGFsbGNvZGUuY29tIiwiaXNzIjoiY2xvdWRjb250YWN0IiwibmJmIjoxNzE5NDQwMjM2LCJpYXQiOjE3MTk0NDAyMzYsInJvbGUiOiJVU0VSIiwiY2xpZW50SWQiOjI2ODIsImlkIjoyNzY0LCJ0eXBlIjoiQVBJX0tFWSIsImtleV9yYW5kb21faWQiOiI1MGRiOTUzZC1hMjUxLTRmZjMtODI5Yi01NjIyOGRhOGE1YTAifQ.PKVjXYHdjBMum9cTgLzFeY2KIb9b2tjawJ0WXalsb8Bckw1RuxeiYKS1bw5Cc36_Rfmivze0T7r-Zy0PVj2omDLq65io0zkBzIEJRNGDn3gx_AqmBrJ3yGnz9s0WTMr2-F1TFPUByzbj1eSOASIKeI7DGufTA5LDrRclVkz32Oo'
]);
// Send a single SMS
$response = $ccai->sms->sendSingle(
firstName: 'Andreas',
lastName: 'Garcia',
phone: '+14156961732',
message: 'Hello ${firstName}, this is a test message!',
title: 'Test Campaign'
);
echo "Message sent with ID: " . $response->id . "\n";
// Send to multiple recipients
$accounts = [
new Account('Andreas', 'Garcia', '+14156961732'),
new Account('Cock', 'Sucker', '+14156961732')
];
$campaignResponse = $ccai->sms->send(
accounts: $accounts,
message: 'Hello ${firstName} ${lastName}, this is a test message!',
title: 'Bulk Test Campaign'
);
var_dump($campaignResponse);
if ($campaignResponse->campaignId === null) {
echo "Campaign is pending approval. ID will be assigned once approved.\n";
} else {
echo "Campaign sent with ID: " . $campaignResponse->campaignId . "\n";
}