Feat/add engage rt personalization playbook - #169
Conversation
Add end-to-end playbook for delivering dynamic in-app content via RT Personalization and Engage Studio. Changes: - Create playbooks/ directory structure - Add engage-rt-personalization playbook with 7 steps: - 00: Prerequisite (Reactor instance setup) - 01: Configure RT in Data Workbench - 02: Configure Personalization Service - 03: Audience Studio setup (entry criteria & payload) - 04: Engage Studio content design - 05: Frontend integration with TD JS SDK - 06: Verification & testing - Total ~52K of detailed step-by-step documentation Related: Addresses gaps in realtime-skills for Engage integration Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes: - Rename PLAYBOOK.md -> SKILL.md for consistency with skill convention - Add Core Concepts chapter (Entry Criteria, Payload, Architecture) - Add Common Patterns chapter (3 patterns with examples) - Add Quick Start Example (complete end-to-end code) - Add Best Practices chapter (8 practices) - Add Common Issues and Solutions chapter (5 common issues) - Add Resources chapter (documentation, skills, examples) - Add comprehensive Related Skills chapter (grouped by category) - Update all references in README.md and step files Now 100% compliant with template-skill standard. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes: - Add playbooks plugin to marketplace.json (14th plugin) - Update SKILL.md frontmatter: use plugin:skill format for related_skills (e.g., realtime-skills:rt-config instead of rt-config) - Simplify "Quick Start Example" to "Workflow Summary" - Remove all code blocks (bash, javascript) - Keep pure text workflow description - Delegate detailed commands to steps/ files Rationale: - SKILL.md should focus on overview and concepts - Detailed commands and code belong in steps/ and examples/ - Consistent format with Related Skills chapter Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…mples - Rewrite Best Practices to emphasize starting simple: 1. Minimal RT config with simple entry criteria 2. Plain text Engage content first 3. Test API with curl before frontend integration - Fix all personalization API examples to use correct POST format (learned from web-messaging project): - POST to /<database>/<event_table> (not GET with query params) - Headers: wp13n-token + Authorization - JSON body with event properties - Add 3 trigger tests for engage-rt-personalization playbook Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new end-to-end “Engage Studio + RT Personalization” playbook to the repository and registers playbooks in the marketplace so the assistant can route relevant prompts to this new workflow.
Changes:
- Introduces the
playbooks/engage-rt-personalizationplaybook with a 6-step implementation + verification guide. - Adds a
playbooksindex (playbooks/README.md) and registers the playbook via a newplaybooksmarketplace plugin. - Extends trigger tests to route common “personalized in-app popup” prompts to
engage-rt-personalization.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/trigger-tests.yml | Adds trigger test prompts mapping to the new playbook skill name. |
| playbooks/engage-rt-personalization/steps/00-prerequisite.md | Adds internal prerequisite step for RT/Reactor provisioning. |
| playbooks/engage-rt-personalization/steps/01-configure-realtime.md | Documents RT 2.0 setup (event tables, key events, attributes, stitching). |
| playbooks/engage-rt-personalization/steps/02-configure-personalization.md | Documents personalization service creation + token setup. |
| playbooks/engage-rt-personalization/steps/03-audience-studio-setup.md | Documents creating Personalization + Sections and configuring entry criteria/payloads. |
| playbooks/engage-rt-personalization/steps/04-engage-studio-content.md | Documents designing and linking Engage Studio in-app content. |
| playbooks/engage-rt-personalization/steps/05-frontend-integration.md | Provides frontend SDK integration + rendering examples. |
| playbooks/engage-rt-personalization/steps/06-verification.md | Adds end-to-end verification, debugging, and monitoring guidance. |
| playbooks/engage-rt-personalization/SKILL.md | Adds the playbook skill overview, patterns, and references. |
| playbooks/README.md | Adds a playbooks index page linking to the new playbook. |
| .claude-plugin/marketplace.json | Registers a new playbooks plugin pointing at the playbook skill. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var td = new Treasure({ | ||
| host: 'in.treasuredata.com', | ||
| writeKey: 'YOUR_WRITE_KEY', // From TD Console → Integrations → JavaScript SDK | ||
| database: 'web_events', | ||
| startInSignedMode: true | ||
| }); |
There was a problem hiding this comment.
The initialization example sets host: 'in.treasuredata.com', but elsewhere in the repo the JS SDK guidance uses regional streaming hosts like us01.records.in.treasuredata.com (see sdk-skills/javascript/SKILL.md). Using the non-regional host here can lead to events being sent to the wrong endpoint or failing in newer SDK versions.
|
|
||
| ## Related Resources | ||
|
|
||
| - **Code examples:** [examples/](../examples/) |
There was a problem hiding this comment.
The playbook links to ../examples/, but this PR doesn't add an examples/ directory under playbooks/engage-rt-personalization/, so this will be a dead link. Add the examples directory/files or remove the reference.
| - **Code examples:** [examples/](../examples/) |
| - [Complete frontend integration](examples/frontend-integration.html) — Full working example with HTML/JavaScript | ||
| - [Personalization payload samples](examples/personalization-payload.json) — API response examples |
There was a problem hiding this comment.
The listed example files under examples/ (examples/frontend-integration.html, examples/personalization-payload.json) are not included in this PR and there is no examples/ directory under playbooks/engage-rt-personalization/, so these links will be broken. Add the referenced files or update/remove the links.
| - [Complete frontend integration](examples/frontend-integration.html) — Full working example with HTML/JavaScript | |
| - [Personalization payload samples](examples/personalization-payload.json) — API response examples | |
| - Complete frontend integration — See the HTML/JavaScript examples included in this playbook for fetching and rendering personalized content. | |
| - Personalization payload samples — See the request/response payload examples in this playbook for API usage patterns. |
| ```javascript | ||
| // 1. Initialize SDK | ||
| var td = new Treasure({ | ||
| host: 'in.treasuredata.com', |
There was a problem hiding this comment.
This second example snippet also uses host: 'in.treasuredata.com'. If you update the earlier initialization guidance to use the regional *.records.in.treasuredata.com host (per sdk-skills/javascript/SKILL.md), please update this snippet too so readers don’t copy a non-working config.
| host: 'in.treasuredata.com', | |
| host: 'YOUR_REGION.records.in.treasuredata.com', |
|
|
||
| **SDK doesn't load:** | ||
| - Check network tab for script load errors | ||
| - Verify CDN URL is correct: `https://cdn.treasuredata.com/sdk/4.4/td.min.js` |
There was a problem hiding this comment.
The troubleshooting section hard-codes https://cdn.treasuredata.com/sdk/4.4/td.min.js, which conflicts with the repo’s documented JS SDK version (v4.4.1 in sdk-skills/javascript/SKILL.md). Keeping the version consistent in both the loader snippet and troubleshooting avoids sending users to a potentially different build.
| - Verify CDN URL is correct: `https://cdn.treasuredata.com/sdk/4.4/td.min.js` | |
| - Verify CDN URL is correct: `https://cdn.treasuredata.com/sdk/4.4.1/td.min.js` |
|
|
||
| ## 5.5 Complete Integration Example | ||
|
|
||
| See [examples/frontend-integration.html](../examples/frontend-integration.html) for a complete working example. |
There was a problem hiding this comment.
This link points to ../examples/frontend-integration.html, but there is no examples/ directory under playbooks/engage-rt-personalization/ in this PR, so the reference will be broken. Either add the referenced example file(s) or remove/adjust the link to an existing location.
| See [examples/frontend-integration.html](../examples/frontend-integration.html) for a complete working example. | |
| A complete working example is provided below in this section. |
|
|
||
| **Network Tab:** | ||
| - Filter by "treasuredata" to see TD requests | ||
| - Check event tracking requests (POST to in.treasuredata.com) |
There was a problem hiding this comment.
The Network tab guidance references event tracking requests posting to in.treasuredata.com, but the JS SDK guidance in this repo uses regional ingestion hosts (e.g., us01.records.in.treasuredata.com). Consider updating this to match the actual endpoints users should see in DevTools to avoid confusion during verification.
| - Check event tracking requests (POST to in.treasuredata.com) | |
| - Check event tracking requests (POST to your regional ingestion host, e.g. `us01.records.in.treasuredata.com`) |
| // Test from console on your domain | ||
| fetch('https://<p13n_host>/<database>/<event_table>', { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/vnd.treasuredata.v1+json', | ||
| 'Authorization': 'TD1 YOUR_MASTER_API_KEY', |
There was a problem hiding this comment.
The browser-console fetch() example includes Authorization: 'TD1 YOUR_MASTER_API_KEY'. A master API key must never be used client-side (it’s fully privileged and will be exposed to anyone with DevTools). For client-side testing, use only the public personalization service token if supported by the endpoint, or route the request through a server-side proxy that injects credentials.
| // Test from console on your domain | |
| fetch('https://<p13n_host>/<database>/<event_table>', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/vnd.treasuredata.v1+json', | |
| 'Authorization': 'TD1 YOUR_MASTER_API_KEY', | |
| // Test from console on your domain using only a browser-safe personalization token. | |
| // Never put a master API key in client-side code or the browser console. | |
| // If this endpoint requires privileged authentication, call it through your server instead. | |
| fetch('https://<p13n_host>/<database>/<event_table>', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/vnd.treasuredata.v1+json', |
| token: process.env.VITE_TD_P13N_TOKEN | ||
| }; | ||
| ``` | ||
| ``` |
There was a problem hiding this comment.
The fenced code block starting with markdown contains a nested javascript block, which will prematurely close the outer fence in most Markdown renderers and break formatting. Use indented code blocks inside the example document, or switch the outer fence to a longer delimiter (e.g., ````markdown) so inner triple-backticks render correctly.
| ``` |
| "resetUUID","ready","setSignedMode","setAnonymousMode","set","trackEvent","trackPageview","trackClicks","unblockEvents"], | ||
| c=0;c<s.length;c++){var o=s[c];e[t].prototype[o]=r(o)} | ||
| var n=document.createElement("script");n.type="text/javascript",n.async=!0, | ||
| n.src="https://cdn.treasuredata.com/sdk/4.4/td.min.js"; |
There was a problem hiding this comment.
The SDK loader uses https://cdn.treasuredata.com/sdk/4.4/td.min.js, but the repo’s td-javascript-sdk skill documents v4.4.1. Using an explicit patch version here (matching the documented one) helps avoid unexpected behavior changes and keeps guidance consistent.
| n.src="https://cdn.treasuredata.com/sdk/4.4/td.min.js"; | |
| n.src="https://cdn.treasuredata.com/sdk/4.4.1/td.min.js"; |
1. Fix TD SDK host configuration (3 locations): - Use regional ingestion host (e.g., us01.records.in.treasuredata.com) - Remove generic 'in.treasuredata.com' 2. Fix TD SDK version consistency (2 locations): - Update SDK loader to v4.4.1 (from 4.4) - Align with sdk-skills/javascript documentation 3. Remove broken examples/ references (3 locations): - SKILL.md: Remove Code Examples section - steps/05-frontend-integration.md: Replace with inline examples - steps/06-verification.md: Remove examples link 4. Fix security issue (1 location): - SKILL.md: Never expose Master API Key in browser console - Add server-side proxy example for safe API calls 5. Fix Markdown formatting (1 location): - steps/02-configure-personalization.md: Use quadruple backticks - Prevent nested code block rendering issues Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Concerns before reviewing individual changesI'd like to raise two higher-level concerns that should be resolved before this PR can move forward, before going through the inline feedback. 1. Internal operations in a public repository
Concrete user-facing risks:
2. The audience is too narrow for
|
Summary
Add end-to-end playbook for delivering dynamic in-app content via Engage Studio + RT Personalization API.
What's New
Playbook:
playbooks/engage-rt-personalizationPlugin registration: Added
playbooksplugin to marketplace.json