@velaro/cli 1.4.204 → 1.4.206
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/campaigns.js +31 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* velaro campaigns benchmarks Your broadcast open/click rate vs. the Velaro average
|
|
5
5
|
* velaro campaigns revenue [--days N] Order revenue attributed to campaign email
|
|
6
6
|
* velaro campaigns revenue-window [--set DAYS] Read or set the attribution window (1-30 days)
|
|
7
|
+
* velaro campaigns sender [--source campaign|ticket|notification] [--name N] [--address A] [--reset] Read or set the From sender per mail source
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import { request } from '../api.js';
|
|
@@ -50,6 +51,26 @@ async function revenueWindowHandler(argv) {
|
|
|
50
51
|
console.log(`Attribution window: ${r.windowDays} days (max ${r.maxWindowDays})`);
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
async function senderHandler(argv) {
|
|
55
|
+
const src = argv.source || 'campaign';
|
|
56
|
+
if (argv.reset) {
|
|
57
|
+
const r = await request('DELETE', `/SiteSenderSettings/${encodeURIComponent(src)}`);
|
|
58
|
+
console.log(`Sender for ${r.source} reset to the account default (${r.effective.fromAddress}).`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (argv.name !== undefined || argv.address !== undefined) {
|
|
62
|
+
const body = {};
|
|
63
|
+
if (argv.name !== undefined) body.fromName = String(argv.name);
|
|
64
|
+
if (argv.address !== undefined) body.fromAddress = String(argv.address);
|
|
65
|
+
const r = await request('PUT', `/SiteSenderSettings/${encodeURIComponent(src)}`, body);
|
|
66
|
+
console.log(`Sender for ${r.source}: ${r.effective.fromName} <${r.effective.fromAddress}>`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const r = await request('GET', '/SiteSenderSettings');
|
|
70
|
+
for (const s of r.sources || []) console.log(`${s.source}: ${s.effective.fromName} <${s.effective.fromAddress}> (from ${s.effective.origin})`);
|
|
71
|
+
console.log(`Verified sending domains: ${(r.verifiedDomains || []).join(', ') || 'none'}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
53
74
|
// -- command export ------------------------------------------------------------------
|
|
54
75
|
|
|
55
76
|
export const campaignsCommand = {
|
|
@@ -73,6 +94,16 @@ export const campaignsCommand = {
|
|
|
73
94
|
builder: y2 => y2.option('set', { type: 'number', describe: 'New window in days' }),
|
|
74
95
|
handler: runCommand(revenueWindowHandler),
|
|
75
96
|
})
|
|
97
|
+
.command({
|
|
98
|
+
command: 'sender',
|
|
99
|
+
describe: 'Read or set the From name/address per mail source (address must be on a verified sending domain)',
|
|
100
|
+
builder: y2 => y2
|
|
101
|
+
.option('source', { type: 'string', describe: 'Mail source (campaign, ticket, notification)' })
|
|
102
|
+
.option('name', { type: 'string', describe: 'From name' })
|
|
103
|
+
.option('address', { type: 'string', describe: 'From address (plain email)' })
|
|
104
|
+
.option('reset', { type: 'boolean', describe: 'Back to the account default' }),
|
|
105
|
+
handler: runCommand(senderHandler),
|
|
106
|
+
})
|
|
76
107
|
.demandCommand(1, 'Specify a subcommand. Try: velaro campaigns --help')
|
|
77
108
|
.strict(),
|
|
78
109
|
handler: () => {},
|
package/package.json
CHANGED