Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.git
.github
node_modules/
coverage/
dist/
examples/
*.md
LICENSE
.env
.env.*
*.log
*.jpg
*.sh
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,45 @@ await ccai.contact.setDoNotText(false, undefined, '+15551234567');
await ccai.contact.setDoNotText(true, 'contact-abc-123');
```

### Contact Validator

Validate email addresses and phone numbers.

> Bulk endpoints accept up to 50 contacts per request and are processed server-side in chunks.

```typescript
import { CCAI } from 'ccai-node';

const ccai = new CCAI({
clientId: 'YOUR-CLIENT-ID',
apiKey: 'YOUR-API-KEY'
});

// Validate a single email
const emailResult = await ccai.contactValidator.validateEmail('user@example.com');
console.log(emailResult.status); // "valid" | "invalid" | "risky"
console.log(emailResult.metadata.safe_to_send); // true | false

// Validate multiple emails (up to 50, processed server-side in chunks)
const bulkEmails = await ccai.contactValidator.validateEmails([
'user@example.com',
'invalid@nonexistent.xyz'
]);
console.log(bulkEmails.summary); // { total: 2, valid: 1, invalid: 1, risky: 0 }

// Validate a single phone number
const phoneResult = await ccai.contactValidator.validatePhone('+15551234567', 'US');
console.log(phoneResult.status); // "valid" | "invalid" | "landline"
console.log(phoneResult.metadata.carrier_type); // "mobile" | "landline" | "voip"

// Validate multiple phone numbers (up to 50, processed server-side in chunks)
const bulkPhones = await ccai.contactValidator.validatePhones([
{ phone: '+15551234567' },
{ phone: '+15559876543', countryCode: 'US' }
]);
console.log(bulkPhones.summary); // { total: 2, valid: 1, invalid: 0, risky: 0, landline: 1 }
```

### Webhooks

CloudContactAI can send webhook notifications when certain events occur, such as when messages are sent or received. Use the Webhook service to register, manage, and verify webhooks programmatically.
Expand Down Expand Up @@ -704,6 +743,7 @@ This project includes a `.gitignore` file that excludes:
- Brand registration and management for TCR verification
- Campaign registration and management for TCR carrier vetting
- Manage contact opt-out preferences (setDoNotText)
- Validate email addresses (valid/invalid/risky) and phone numbers (valid/invalid/landline)
- Webhook management: register, list, update, delete
- Webhook signature verification (HMAC-SHA256)
- Next.js API route handlers for webhook events
Expand Down
17 changes: 17 additions & 0 deletions integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:20-alpine

WORKDIR /sdk
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts

COPY tsconfig.json ./
COPY src/ ./src/
RUN npm run build

WORKDIR /sdk/integration
COPY integration/package.json ./
RUN npm install

COPY integration/ ./

CMD ["npx", "ts-node", "--project", "tsconfig.json", "test.ts"]
20 changes: 20 additions & 0 deletions integration/Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:20-alpine

ARG SDK_VERSION=1.0.2

# Install the published SDK from npm into /sdk
WORKDIR /sdk
RUN npm install ccai-node@${SDK_VERSION}

# test.ts uses `require('../dist/index.js')` — symlink so that path resolves
# to the installed package's compiled output
RUN ln -s /sdk/node_modules/ccai-node/dist /sdk/dist

# Set up the integration test runner (ts-node, typescript, etc.)
WORKDIR /sdk/integration
COPY integration/package.json ./
RUN npm install

COPY integration/ ./

CMD ["npx", "ts-node", "--project", "tsconfig.json", "test.ts"]
16 changes: 16 additions & 0 deletions integration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ccai-test-node",
"version": "1.0.0",
"private": true,
"scripts": {
"test": "ts-node --project tsconfig.json test.ts"
},
"dependencies": {
"axios": "^1.6.7"
},
"devDependencies": {
"@types/node": "^20.11.24",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
}
Loading
Loading