Skip to content

Commit 22bba07

Browse files
committed
env added
1 parent cc95096 commit 22bba07

11 files changed

Lines changed: 59 additions & 24 deletions

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CCAI API Configuration
2+
CCAI_CLIENT_ID=your_client_id_here
3+
CCAI_API_KEY=your_api_key_here

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"dependencies": {
3636
"@types/nodemailer": "^6.4.17",
3737
"axios": "^1.6.7",
38+
"dotenv": "^17.2.1",
3839
"express": "^5.1.0",
3940
"nodemailer": "^7.0.5"
4041
},

src/email_send.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import 'dotenv/config';
12
import { CCAI } from './ccai';
23

34
const ccai = new CCAI({
4-
clientId: '1231',
5-
apiKey: 'eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhbmRyZWFzQGFsbGNvZGUuY29tIiwiaXNzIjoiY2xvdWRjb250YWN0IiwibmJmIjoxNzUyMDg5MDk2LCJpYXQiOjE3NTIwODkwOTYsInJvbGUiOiJVU0VSIiwiY2xpZW50SWQiOjEyMzEsImlkIjoxMjIzLCJ0eXBlIjoiQVBJX0tFWSIsImtleV9yYW5kb21faWQiOiIzNTAxZjVmNC0zOWYyLTRjYzctYTk2Yi04ZDkyZjVlMjM5ZGUifQ.XjtDPpyYUJNJjLrpM1pdQ4Sqk90eaagqzPX2v1gwHDP1wOV4fTbB44UGDRXtWyGvN-Fz7o84_Ab-VlAjNCyEmXcDzmzscnwFSbqiZrWLAM_W3Mutd36vArl9QSG_osuYdf9T2wmAduUZu2bcnvKHdBbEaBUalJSSUoHwHsMBX3w'
5+
clientId: process.env.CCAI_CLIENT_ID || '',
6+
apiKey: process.env.CCAI_API_KEY || '',
67
});
78

89
async function sendEmail() {

src/examples/async-example.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
* @copyright 2025 CloudContactAI LLC
66
*/
77

8+
import dotenv from 'dotenv';
89
import { CCAI } from '../ccai';
910
import type { Account, SMSOptions, SMSResponse } from '../index';
1011

12+
// Load environment variables
13+
dotenv.config();
14+
1115
// Create a new CCAI client
1216
const ccai = new CCAI({
13-
clientId: 'YOUR-CLIENT-ID',
14-
apiKey: 'API-KEY-TOKEN'
17+
clientId: process.env.CCAI_CLIENT_ID || '',
18+
apiKey: process.env.CCAI_API_KEY || ''
1519
});
1620

1721
// Example recipients

src/examples/basic-example.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
* @copyright 2025 CloudContactAI LLC
66
*/
77

8+
import dotenv from 'dotenv';
89
import { CCAI } from '../ccai';
910
import type { Account, SMSResponse } from '../index';
1011

12+
// Load environment variables
13+
dotenv.config();
14+
1115
// Create a new CCAI client
1216
const ccai = new CCAI({
13-
clientId: 'YOUR-CLIENT-ID',
14-
apiKey: 'API-KEY-TOKEN'
17+
clientId: process.env.CCAI_CLIENT_ID || '',
18+
apiKey: process.env.CCAI_API_KEY || ''
1519
});
1620

1721
// Example recipients

src/examples/email-examples.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
* Examples of using the Email functionality in the CCAI library
33
*/
44

5+
import 'dotenv/config';
56
import { CCAI, EmailCampaign } from '../index';
67

78
// Initialize the CCAI client
89
const ccai = new CCAI({
9-
clientId: '1231',
10-
apiKey: 'eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhbmRyZWFzQGFsbGNvZGUuY29tIiwiaXNzIjoiY2xvdWRjb250YWN0IiwibmJmIjoxNzUyMDg5MDk2LCJpYXQiOjE3NTIwODkwOTYsInJvbGUiOiJVU0VSIiwiY2xpZW50SWQiOjEyMzEsImlkIjoxMjIzLCJ0eXBlIjoiQVBJX0tFWSIsImtleV9yYW5kb21faWQiOiIzNTAxZjVmNC0zOWYyLTRjYzctYTk2Yi04ZDkyZjVlMjM5ZGUifQ.XjtDPpyYUJNJjLrpM1pdQ4Sqk90eaagqzPX2v1gwHDP1wOV4fTbB44UGDRXtWyGvN-Fz7o84_Ab-VlAjNCyEmXcDzmzscnwFSbqiZrWLAM_W3Mutd36vArl9QSG_osuYdf9T2wmAduUZu2bcnvKHdBbEaBUalJSSUoHwHsMBX3w'
10+
clientId: process.env.CCAI_CLIENT_ID || '',
11+
apiKey: process.env.CCAI_API_KEY || '',
1112
});
1213

1314
/**

src/examples/example.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
* @copyright 2025 CloudContactAI LLC
66
*/
77

8+
import dotenv from 'dotenv';
89
import { CCAI } from '../ccai';
910
import type { Account, SMSResponse } from '../index';
1011

12+
// Load environment variables
13+
dotenv.config();
14+
1115
// Create a new CCAI client
12-
// Replace these values with your actual credentials
1316
const ccai = new CCAI({
14-
clientId: 'YOUR-CLIENT-ID',
15-
apiKey: 'YOUR-API-KEY'
17+
clientId: process.env.CCAI_CLIENT_ID || '',
18+
apiKey: process.env.CCAI_API_KEY || ''
1619
});
1720

1821
// Example recipients

src/examples/mms-example.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
* @copyright 2025 CloudContactAI LLC
66
*/
77

8+
import dotenv from 'dotenv';
89
import { CCAI, Account, SMSOptions } from '../index';
910

10-
// Replace with your actual credentials
11-
const CLIENT_ID = 'your-client-id';
12-
const API_KEY = 'your-api-key';
11+
// Load environment variables
12+
dotenv.config();
1313

1414
// Initialize the CCAI client
1515
const ccai = new CCAI({
16-
clientId: CLIENT_ID,
17-
apiKey: API_KEY
16+
clientId: process.env.CCAI_CLIENT_ID || '',
17+
apiKey: process.env.CCAI_API_KEY || ''
1818
});
1919

2020
// Define a progress callback
@@ -141,7 +141,7 @@ async function sendMmsStepByStep() {
141141
async function sendSingleMms() {
142142
try {
143143
// Define the file key of an already uploaded image
144-
const pictureFileKey = `${CLIENT_ID}/campaign/your-image.jpg`;
144+
const pictureFileKey = `${process.env.CCAI_CLIENT_ID}/campaign/your-image.jpg`;
145145

146146
// Send a single MMS
147147
const response = await ccai.mms.sendSingle(

src/mms_send.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
import dotenv from 'dotenv';
12
import { CCAI } from './ccai';
23

4+
// Load environment variables
5+
dotenv.config();
6+
37
const ccai = new CCAI({
4-
clientId: 'YOUR-CLIENT-ID',
5-
apiKey: 'YOUR-API-KEY'
8+
clientId: process.env.CCAI_CLIENT_ID || '',
9+
apiKey: process.env.CCAI_API_KEY || ''
610
});
711

812
async function sendMMS() {
@@ -12,9 +16,9 @@ async function sendMMS() {
1216
const contentType = 'image/jpeg';
1317

1418
const accounts = [{
15-
firstName: "John",
16-
lastName: "Doe",
17-
phone: "+15551234567"
19+
firstName: "Thavas",
20+
lastName: "Antonio",
21+
phone: "+15551234567" // Update with actual phone number
1822
}];
1923

2024
const response = await ccai.mms.sendWithImage(

0 commit comments

Comments
 (0)