=== Infrastructure Roadmap === == For Crowdfunding Campaign == View our [[https://pm.rekonas.com/projects/kickstarter-campaign/gantt?query_props=%7B%22tll%22%3A%22%7B%5C%22left%5C%22%3A%5C%22startDate%5C%22%2C%5C%22right%5C%22%3A%5C%22dueDate%5C%22%2C%5C%22farRight%5C%22%3A%5C%22subject%5C%22%7D%22%2C%22tzl%22%3A%22auto%22%2C%22tv%22%3Atrue%2C%22hi%22%3Atrue%2C%22t%22%3A%22start_date%3Aasc%22%2C%22c%22%3A%5B%22id%22%2C%22type%22%2C%22subject%22%2C%22status%22%2C%22startDate%22%2C%22dueDate%22%2C%22duration%22%5D%2C%22f%22%3A%5B%7B%22n%22%3A%22status%22%2C%22o%22%3A%22o%22%2C%22v%22%3A%5B%5D%7D%5D%7D&name=all_open|project]] for more details. Infrastructure we still need: * Campaign Website ======== Ecosystem Overview ======== * n8n: Orchestrates the automations and connects all systems. * Stripe: Captures payments (Checkout) and emits webhooks. * Shopware: Store backend where VIP promotion codes/coupons are created. * Mautic: Marketing automation/CRM; stores contacts, fields, and sends emails. * Discord: Community platform; API used to generate single-use invite links. * EspoCRM: Sales CRM; leads are ensured/created for marketing contacts. ======= Workflow 1: Mautic Contact Updated → Discord Invite(s) → Mautic + EspoCRM Sync → Invite Email ======= Purpose: When a Mautic contact is updated and has opted in, this workflow issues the correct Discord invite (VIP or Basic), saves the link on the Mautic contact, ensures a Lead exists in EspoCRM, and emails the invite. It includes jitter and “already has a link?” checks to prevent duplicates. ==== Steps ==== * Trigger: Mautic "Contact Updated" * Wait 0–3s (jitter to reduce concurrent updates) * Check if "opt_in_confirmed" is true; otherwise, stop * If "vip_status" is true: * Check if VIP Discord invite link exists * If not, wait 0.3–1.2s, re-fetch contact, check again * If still missing, issue VIP Discord invite link (via Discord API) * Update Mautic contact with discord_invite_link_vip * Check if link was successfully added * Send VIP Discord invite email to contact (from Mautic) * Else (non-VIP): * Check if Basic Discord invite link exists * If not, wait 0.3–1.2s, re-fetch contact, check again * If still missing, issue Basic Discord invite link (via Discord API) * Update Mautic contact with discord_invite_link_basic * Check if link was successfully added * Send Basic Discord invite email to contact (from Mautic) * EspoCRM Sync: * Try to retrieve Lead by contact attributes (typically email) * If not found, create Lead in EspoCRM (via HTTP POST) {{:screenshot_from_2025-08-19_18-36-42.png?600|}} === Outputs & Side Effects === * Mautic contact has exactly one stored Discord invite link (VIP or Basic). * Appropriate invite email is sent from Mautic. * A corresponding Lead exists in EspoCRM. ======== Workflow 2: Stripe → VIP Coupon → Mautic Update → Coupon Email ======== Purpose: When a customer successfully purchases a "VIP reservation" via Stripe, this workflow generates a unique Shopware coupon, marks the buyer as VIP in Mautic, and sends the coupon by email. ==== Steps ==== * Trigger: Stripe webhook on checkout.session.completed * Check if payment was successful * Look up session in Stripe to get line items * If the product was a VIP reservation, continue; otherwise, stop * Generate promo code (unique for each purchase) * Add promo code to VIP promotion in Shopware (via HTTP POST) * Find corresponding contact in Mautic (by email) * Merge promo code and contact details * Set contact "vip_status" to true and assign promo code in Mautic * Send email with coupon to contact (from Mautic) {{:screenshot_from_2025-08-19_18-36-42.png?400|}} === Outputs & Side Effects === * A new single-use promo code is created in Shopware’s VIP promotion. * The buyer’s Mautic contact is marked as VIP and stores the promo code. * Coupon email is sent from Mautic. ==== Notes ==== * Only runs for successful payments and only for the VIP product. * Contact matching uses the email captured by Stripe. * If the Shopware API call fails, the Mautic update/email won’t run (prevents partial state). ==== Field Conventions (Mautic Contact) ==== * vip_status: boolean * promo_code: string (from Workflow 1) * discord_invite_link_vip / discord_invite_link_basic: strings * opt_in_confirmed: boolean (gate for all messaging) ==== Operational Tips ==== * Credentials needed: Stripe (API + webhook secret), Mautic API + email config, Shopware API token, Discord Bot token, EspoCRM API credentials. * Respect Discord rate limits; n8n waits help mitigate 429s. * To reissue an invite, clear the relevant invite link field in Mautic and save; the workflow will create a new link. * Troubleshooting: Shopware errors stop coupon issuance; Mautic update failures prevent emails; duplicate invites usually mean a field name mismatch or a parallel process overwriting values.