Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

fix(onesignal): reject conflicting notification audience options

Rudy Celekli9d1f9d6802ef
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 39ddc4c..68a230d 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -6,7 +6,7 @@
},
"metadata": {
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"repository": "https://github.com/coreyhaines31/marketingskills"
},
"plugins": [
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index f1a5cf8..aabe26f 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 45d9d89..9cd1f4c 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/VERSIONS.md b/VERSIONS.md
index dc6d5ce..38c05f4 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -57,6 +57,10 @@ Current versions of all skills. Agents can compare against local versions to che
## Recent Changes
+### 2.11.27 (2026-10-10)
+
+- Reject conflicting OneSignal audience flags instead of silently choosing a broader target.
+
### 2.11.26 (2026-10-08)
- **lead-magnets** (2.0.0 → 2.1.0): new `references/content-to-skill.md` (plus corpus design and release companions) on packaging a course, webinar series, podcast, or newsletter archive you own as an installable agent skill: a new kind of lead magnet. From @rudycelekli's #725 (closes #432), folded in rather than added as a new skill. Triggers added: 'course as a skill,' 'package our content as an agent skill.' **ai-seo** (2.7.5 → 2.7.6) points to it.
diff --git a/tests/clis/onesignal-targeting-conflicts.test.cjs b/tests/clis/onesignal-targeting-conflicts.test.cjs
new file mode 100644
index 0000000..2d13b9f
--- /dev/null
+++ b/tests/clis/onesignal-targeting-conflicts.test.cjs
@@ -0,0 +1,20 @@
+const {test}=require('node:test')
+const assert=require('node:assert/strict')
+const {spawnSync}=require('node:child_process')
+const path=require('node:path')
+const cli=path.resolve(__dirname,'../../tools/clis/onesignal.js')
+function run(flags,preview=false){
+ const args=['notifications','send','--message','Hello','--heading','Welcome',...flags];if(preview)args.push('--dry-run')
+ const source=`global.fetch=async(url,opts)=>{process.stderr.write('FETCH_CALLED');return {status:200,text:async()=>JSON.stringify({body:JSON.parse(opts.body)})}};process.argv=['node',${JSON.stringify(cli)},...${JSON.stringify(args)}];require(${JSON.stringify(cli)})`
+ return spawnSync(process.execPath,['-e',source],{encoding:'utf8',env:{...process.env,ONESIGNAL_APP_ID:'fixture-app',ONESIGNAL_REST_API_KEY:'fixture-key'},timeout:5000})
+}
+const audiences=[['--segment','Active Users'],['--emails','[email protected]'],['--player-ids','subscription-fixture'],['--aliases','person-fixture']]
+test('conflicting audience selectors fail before delivery or preview',()=>{
+ for(let i=0;i<audiences.length;i++)for(let j=i+1;j<audiences.length;j++)for(const preview of [false,true]){
+ const result=run([...audiences[i],...audiences[j]],preview);assert.equal(result.status,1,result.stdout);assert.equal(result.stderr.includes('FETCH_CALLED'),false);assert.match(JSON.parse(result.stderr).error,/only one audience option/);assert.equal(result.stdout,'')
+ }
+})
+test('individual targeting options and default retain their audience payload',()=>{
+ const expected=[{included_segments:['Active Users']},{email_to:['[email protected]']},{include_player_ids:['subscription-fixture']},{include_aliases:{external_id:['person-fixture']}},{included_segments:['Subscribed Users']}]
+ for(let i=0;i<5;i++)for(const preview of [false,true]){const result=run(audiences[i]||[],preview);assert.equal(result.status,0,result.stderr);const body=JSON.parse(result.stdout).body;for(const [key,value]of Object.entries(expected[i]))assert.deepEqual(body[key],value);assert.equal(body.target_channel,i===1?'email':'push')}
+})
diff --git a/tools/clis/onesignal.js b/tools/clis/onesignal.js
index 57776c2..d4cbc60 100755
--- a/tools/clis/onesignal.js
+++ b/tools/clis/onesignal.js
@@ -69,6 +69,10 @@ async function main() {
case 'notifications':
switch (sub) {
case 'send': {
+ const targetingFlags = ['segment', 'emails', 'player-ids', 'aliases'].filter(name => args[name] !== undefined)
+ if (targetingFlags.length > 1) {
+ throw new Error('Use only one audience option: --segment, --emails, --player-ids, or --aliases')
+ }
const channel = args.channel || (args.emails ? 'email' : 'push')
if (!['push', 'email', 'sms'].includes(channel)) { result = { error: '--channel must be push, email, or sms' }; break }
if (args.emails && channel !== 'email') { result = { error: '--emails requires the email channel' }; break }