← back to Dw Validator Debug TK11314
CC: add test-send helper (native CC v3 preview to internal addresses)
4ba6287b37758b10c13b511412e1124f8fc26f8f · 2026-08-10 08:26:43 -0700 · Steve
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
A mailers/cc-api/test-send.js
Diff
commit 4ba6287b37758b10c13b511412e1124f8fc26f8f
Author: Steve <steve@designerwallcoverings.com>
Date: Mon Aug 10 08:26:43 2026 -0700
CC: add test-send helper (native CC v3 preview to internal addresses)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
mailers/cc-api/test-send.js | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/mailers/cc-api/test-send.js b/mailers/cc-api/test-send.js
new file mode 100644
index 00000000..a70881ef
--- /dev/null
+++ b/mailers/cc-api/test-send.js
@@ -0,0 +1,39 @@
+'use strict';
+// One-shot CC v3 test-send (preview) of an existing campaign activity to internal addresses.
+// Usage: node test-send.js <activity_id> <comma-separated-emails>
+const https = require('https');
+const cc = require('./cc-client');
+
+const activityId = process.argv[2];
+const emails = (process.argv[3] || '').split(',').map(s => s.trim()).filter(Boolean);
+if (!activityId || !emails.length) { console.error('usage: node test-send.js <activity_id> <a@b.com,c@d.com>'); process.exit(1); }
+
+function post(pathname, token, body) {
+ return new Promise((resolve, reject) => {
+ const data = JSON.stringify(body);
+ const req = https.request('https://api.cc.email/v3' + pathname, {
+ method: 'POST',
+ headers: {
+ Authorization: `Bearer ${token}`,
+ 'Content-Type': 'application/json',
+ Accept: 'application/json',
+ 'Content-Length': Buffer.byteLength(data),
+ },
+ }, (res) => {
+ let buf = ''; res.on('data', d => buf += d);
+ res.on('end', () => resolve({ status: res.statusCode, body: buf }));
+ });
+ req.on('error', reject); req.write(data); req.end();
+ });
+}
+
+(async () => {
+ const token = await cc.getAccessToken();
+ const r = await post(`/emails/activities/${activityId}/tests`, token, {
+ email_addresses: emails,
+ personal_message: 'Preview — The Classics (Kravet-family chinoiserie/traditional). Draft only, not sent to any list.',
+ });
+ console.log('test-send HTTP', r.status);
+ console.log(r.body || '(empty body = accepted)');
+ process.exitCode = (r.status >= 200 && r.status < 300) ? 0 : 2;
+})().catch(e => { console.error('ERROR', e.message); process.exitCode = 1; });
← 2eea5ae1 CC: rebuild New Arrivals email as 'The Classics' — Kravet-fa
·
back to Dw Validator Debug TK11314
·
Mailer: replace two palm-frond Nouvelle (Brunschwig) pattern 50ac2271 →