=============== LIBRARY RULES =============== From library maintainers: - Wraps deploys infrastructure to the user's AWS account — it is not a managed service - Use @wraps.dev/email for the email SDK and @wraps.dev/sms for the SMS SDK - All AWS resources are namespaced with wraps- prefix (wraps-email-*, wraps-sms-*, wraps-cdn-*) - ESM only — no require() or module.exports - CLI entry point: npx @wraps.dev/cli (e.g. wraps email init) - Non-destructive by design — never modifies existing AWS resources ### Common Workflows Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Guides for common setup and operational tasks. ```APIDOC ## Common Workflows ### 1. Deploy email and send first message ```bash npx @wraps.dev/cli email init npx @wraps.dev/cli email domains add -d yourapp.com npx @wraps.dev/cli email domains get-dkim -d yourapp.com # Add CNAME records to DNS provider npx @wraps.dev/cli email domains verify -d yourapp.com npm install @wraps.dev/email ``` ### 2. Deploy SMS and send first message ```bash npx @wraps.dev/cli sms init npx @wraps.dev/cli sms verify-number --phoneNumber +14155551234 npx @wraps.dev/cli sms test --to +14155551234 --message "Hello!" npm install @wraps.dev/sms ``` ### 3. Run deliverability audit ```bash npx @wraps.dev/cli email check yourapp.com # Checks DKIM, SPF, DMARC, MX TLS, blacklists ``` ### 4. Connect existing SES and upgrade ```bash npx @wraps.dev/cli email connect npx @wraps.dev/cli email upgrade ``` ``` -------------------------------- ### Start Local Web Dashboard (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Starts a local web dashboard for managing Wraps services. This provides a graphical interface for interacting with your Wraps setup. ```bash wraps console ``` -------------------------------- ### Initialize and Install Wraps Infrastructure Source: https://github.com/wraps-team/wraps/blob/main/README.md Commands to initialize the email infrastructure in an AWS account and install the necessary SDK package. ```bash npx @wraps.dev/cli email init ``` ```bash pnpm add @wraps.dev/email ``` -------------------------------- ### Install Wraps CLI and SDKs Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Provides instructions for installing the Wraps CLI and its associated TypeScript SDKs. The CLI can be used directly via npx for infrastructure deployment without installation, while SDKs need to be installed via npm for programmatic use. ```bash # Deploy infrastructure (no install needed) npx @wraps.dev/cli email init # Install SDKs npm install @wraps.dev/email npm install @wraps.dev/sms ``` -------------------------------- ### Start Email Templates Preview Server (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Starts a local preview server for email templates with hot-reloading capabilities. This allows you to see changes to your templates in real-time. ```bash wraps email templates preview ``` -------------------------------- ### Telemetry Status Output Example (Bash) Source: https://github.com/wraps-team/wraps/blob/main/docs/telemetry.md This is an example of the output when running the 'wraps telemetry status' command, indicating that telemetry is disabled and showing the path to the configuration file. It also includes instructions for enabling telemetry. ```bash Telemetry Status: Status: Disabled Config file: ~/.config/wraps/telemetry.json How to opt-in: wraps telemetry enable ``` -------------------------------- ### Example Service Deployment Event (TypeScript) Source: https://github.com/wraps-team/wraps/blob/main/docs/telemetry.md This snippet illustrates the format of a 'service:deployed' event, which includes the service name, deployment duration, features utilized, and the deployment preset. It's used to monitor service deployments. ```typescript { event: "service:deployed", properties: { service: "email", duration_ms: 120000, features: ["tracking", "history"], preset: "production" } } ``` -------------------------------- ### Example Command Execution Event (TypeScript) Source: https://github.com/wraps-team/wraps/blob/main/docs/telemetry.md This snippet shows the structure of a 'command:email:init' event, including success status, duration, preset, provider, CLI version, OS, Node.js version, and CI status. It's used to track command executions. ```typescript { event: "command:email:init", properties: { success: true, duration_ms: 45000, preset: "production", provider: "vercel", cli_version: "1.2.0", os: "darwin", node_version: "v20.10.0", ci: false } } ``` -------------------------------- ### Retrieve IAM Role ARN Source: https://github.com/wraps-team/wraps/blob/main/docs/VERCEL_OIDC_SETUP.md Queries the CloudFormation stack outputs to retrieve the BackendRoleArn required for Vercel environment configuration. ```bash AWS_PROFILE=wraps aws cloudformation describe-stacks \ --stack-name wraps-vercel-oidc \ --region us-east-1 \ --query 'Stacks[0].Outputs[?OutputKey==`BackendRoleArn`].OutputValue' \ --output text ``` -------------------------------- ### Initialize SMS Infrastructure with Wraps CLI Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms.txt This command initializes SMS infrastructure with phone number provisioning using the Wraps CLI. It simplifies the setup of AWS services required for sending SMS messages. ```bash npx @wraps.dev/cli sms init ``` -------------------------------- ### Authenticate with Wraps Platform (Device Flow) (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Initiates the authentication process with the Wraps Platform using a device flow. This command guides you through logging in via a separate device. ```bash wraps auth login ``` -------------------------------- ### Initialize Email Infrastructure with Wraps CLI Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms.txt This command initializes the full email stack, including SES, event processing, and history storage, using the Wraps CLI. It automates the setup of multiple AWS services with a single command. ```bash npx @wraps.dev/cli email init ``` -------------------------------- ### Verify OIDC Authentication via CloudTrail Source: https://github.com/wraps-team/wraps/blob/main/docs/VERCEL_OIDC_SETUP.md Uses the AWS CLI to inspect CloudTrail logs for 'AssumeRoleWithWebIdentity' events, confirming that Vercel is successfully authenticating via OIDC. ```bash AWS_PROFILE=wraps aws cloudtrail lookup-events \ --lookup-attributes AttributeKey=EventName,AttributeValue=AssumeRoleWithWebIdentity \ --region us-east-1 \ --max-items 5 ``` -------------------------------- ### Deploy AWS CloudFormation Stack for OIDC Source: https://github.com/wraps-team/wraps/blob/main/docs/VERCEL_OIDC_SETUP.md Deploys the OIDC provider and IAM role to the AWS account using the AWS CLI. Requires Vercel Team and Project IDs as parameters to establish the trust relationship. ```bash VERCEL_TEAM_ID="team_xxxxx" VERCEL_PROJECT_ID="prj_xxxxx" AWS_PROFILE=wraps aws cloudformation create-stack \ --stack-name wraps-vercel-oidc \ --template-body file://cloudformation/vercel-oidc-role.yaml \ --parameters \ ParameterKey=VercelTeamId,ParameterValue=${VERCEL_TEAM_ID} \ ParameterKey=VercelProjectId,ParameterValue=${VERCEL_PROJECT_ID} \ --capabilities CAPABILITY_NAMED_IAM \ --region us-east-1 AWS_PROFILE=wraps aws cloudformation wait stack-create-complete \ --stack-name wraps-vercel-oidc \ --region us-east-1 ``` -------------------------------- ### Sync CDN Infrastructure (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Synchronizes the CDN infrastructure to ensure it matches the desired configuration. This command helps maintain consistency in your CDN setup. ```bash wraps cdn sync ``` -------------------------------- ### Configure Local AWS Environment Variables Source: https://github.com/wraps-team/wraps/blob/main/docs/VERCEL_OIDC_SETUP.md Defines the required AWS profile and account ID for local development within the .env.local file. This configuration allows the application to authenticate correctly during local execution. ```bash AWS_PROFILE=wraps AWS_BACKEND_ACCOUNT_ID=905130073023 ``` -------------------------------- ### Example Error Tracking Event (TypeScript) Source: https://github.com/wraps-team/wraps/blob/main/docs/telemetry.md This example demonstrates the structure for an 'error:occurred' event, detailing the error code, the associated command, CLI version, and operating system. This helps in tracking and diagnosing errors within the Wraps CLI. ```typescript { event: "error:occurred", properties: { error_code: "AWS_CREDENTIALS_INVALID", command: "email:init", cli_version: "1.2.0", os: "linux" } } ``` -------------------------------- ### Diagnose AWS Configuration (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Diagnoses potential issues with your AWS configuration. This command helps identify and resolve common AWS setup problems. ```bash wraps aws doctor ``` -------------------------------- ### Remove Vercel OIDC CloudFormation Stack Source: https://github.com/wraps-team/wraps/blob/main/docs/VERCEL_OIDC_SETUP.md Executes the AWS CLI command to delete the CloudFormation stack associated with Vercel OIDC. This is used for cleaning up infrastructure resources in the us-east-1 region. ```bash AWS_PROFILE=wraps aws cloudformation delete-stack \ --stack-name wraps-vercel-oidc \ --region us-east-1 ``` -------------------------------- ### Deploy AWS Infrastructure with Wraps CLI Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Initiates the deployment of essential AWS infrastructure for email, SMS, or CDN services using the Wraps CLI. This command automates the setup of services like SES, Lambda, DynamoDB, EventBridge, and CloudFront, simplifying complex AWS configurations into a single step. ```bash npx @wraps.dev/cli email init # Email (SES + event processing) npx @wraps.dev/cli sms init # SMS (End User Messaging) npx @wraps.dev/cli cdn init # CDN (S3 + CloudFront) ``` -------------------------------- ### Send Email using Wraps TypeScript SDK Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms.txt This TypeScript code snippet demonstrates how to send an email using the `@wraps.dev/email` SDK. It requires installing the package and then instantiating the `WrapsEmail` class to send emails with HTML content. ```typescript import { WrapsEmail } from '@wraps.dev/email'; const email = new WrapsEmail(); await email.send({ from: 'hello@yourapp.com', to: 'user@example.com', subject: 'Welcome!', html: '

Hello!

', }); ``` -------------------------------- ### Verify Inbound Email DNS Records (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Verifies the DNS records required for inbound email functionality. This is crucial for ensuring proper email delivery to your Wraps setup. ```bash wraps email inbound verify ``` -------------------------------- ### Interact with Email Inbox using WRAPS Email API Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Provides methods to manage the email inbox, including listing, getting, downloading attachments, retrieving raw content, deleting, forwarding, and replying to emails. Requires 'inboxBucketName' during initialization. ```typescript if (email.inbox) { await email.inbox.list({ maxResults: 20 }); await email.inbox.get(messageId); await email.inbox.getAttachment(messageId, attachmentId); // Returns presigned URL (1hr) await email.inbox.getRaw(messageId); await email.inbox.delete(messageId); await email.inbox.forward(messageId, { to: 'other@example.com', from: 'me@example.com' }); await email.inbox.reply(messageId, { from: 'me@example.com', html: '

Reply

' }); } ``` -------------------------------- ### Send Email with Wraps SDK Source: https://github.com/wraps-team/wraps/blob/main/README.md Demonstrates how to initialize the WrapsEmail client and send an email using the TypeScript SDK. ```typescript import { WrapsEmail } from '@wraps.dev/email'; const email = new WrapsEmail(); const { messageId } = await email.send({ from: 'hello@yourapp.com', to: 'user@example.com', subject: 'Welcome!', html: '

Hello from Wraps!

', }); console.log('Sent:', messageId); ``` -------------------------------- ### Initialize Email Templates-as-Code Directory (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Initializes a new directory structure for managing email templates using a templates-as-code approach. This sets up the project for template management. ```bash wraps email templates init ``` -------------------------------- ### Workflow Settings Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Configuration options for workflow execution. ```APIDOC ## Workflow Settings ### Description Configuration options for workflow execution. ### Options - **allowReentry** (`boolean`): Allows the same contact to re-enter the workflow. - **reentryDelaySeconds** (`number`): Minimum seconds between re-entries for the same contact. - **maxConcurrentExecutions** (`number`): Maximum number of parallel workflow executions. - **contactCooldownSeconds** (`number`): Cooldown period before a contact can be re-triggered. ``` -------------------------------- ### Show Overview of All Services (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Provides a comprehensive overview of all managed services and their statuses. This command offers a centralized view of your Wraps environment. ```bash wraps status ``` -------------------------------- ### Initialize SMS Service and Send Test Message Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Outlines the bash commands for initializing the SMS service, verifying a phone number, and sending a test message. This workflow is essential for setting up and confirming SMS sending functionality. ```bash npx @wraps.dev/cli sms init npx @wraps.dev/cli sms verify-number --phoneNumber +14155551234 npx @wraps.dev/cli sms test --to +14155551234 --message "Hello!" npm install @wraps.dev/sms ``` -------------------------------- ### Interactive AWS Credential Wizard (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Launches an interactive wizard to help set up AWS credentials. This simplifies the process of configuring access to AWS services. ```bash wraps aws setup ``` -------------------------------- ### Initialize WrapsEmail SDK Constructor (TypeScript) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Demonstrates the initialization of the `WrapsEmail` SDK constructor in TypeScript. This includes setting up essential configuration options like region, credentials, and clients for various AWS services. ```typescript import { WrapsEmail } from '@wraps.dev/email'; const email = new WrapsEmail({ region?: string, // AWS region (default: us-east-1) credentials?: // Static credentials or provider function | { accessKeyId: string, secretAccessKey: string, sessionToken?: string } | AwsCredentialIdentityProvider, roleArn?: string, // IAM role for OIDC roleSessionName?: string, // Session name for AssumeRole (default: 'wraps-email-session') endpoint?: string, // Custom endpoint (LocalStack) client?: SESClient, // Pre-configured SES client (overrides region/credentials/roleArn) s3Client?: S3Client, // Pre-configured S3 client for inbox sesv2Client?: SESv2Client, // Pre-configured SES v2 client for suppression/batch dynamodbClient?: DynamoDBDocumentClient, // Pre-configured DynamoDB client for events inboxBucketName?: string, // S3 bucket for inbound email (enables email.inbox) historyTableName?: string, // DynamoDB table for events (enables email.events) }); ``` -------------------------------- ### Authentication Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Details on how to authenticate SDKs using a 4-step credential resolution chain. ```APIDOC ## Authentication ### Description All SDKs follow a 4-step credential resolution chain (in priority order). ### 1. Pre-configured AWS client (highest priority) ```typescript import { SESClient } from '@aws-sdk/client-ses'; const sesClient = new SESClient({ /* custom config */ }); const email = new WrapsEmail({ client: sesClient }); // Bypasses all other credential resolution ``` ### 2. OIDC role assumption (Vercel, EKS, GitHub Actions) ```typescript const email = new WrapsEmail({ roleArn: process.env.AWS_ROLE_ARN, roleSessionName: 'my-app-session', // Optional, defaults to 'wraps-email-session' }); // Uses AssumeRoleWithWebIdentity via AWS_WEB_IDENTITY_TOKEN_FILE ``` ### 3. Explicit credentials (static or provider function) ```typescript // Static credentials const email = new WrapsEmail({ credentials: { accessKeyId: process.env.AWS_ACCESS_KEY_ID!, secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!, }, region: 'us-east-1', }); // Credential provider function (e.g., from Vercel OIDC helper) const email = new WrapsEmail({ credentials: myCredentialProvider, // AwsCredentialIdentityProvider }); ``` ### 4. AWS SDK default chain (lowest priority, recommended) ```typescript const email = new WrapsEmail(); // Resolves: env vars -> ~/.aws/credentials -> ECS container -> EC2 instance metadata ``` ``` -------------------------------- ### Workflow Step Helpers Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Functions to define steps within a workflow. ```APIDOC ## Workflow Step Helpers ### Description Functions to define steps within a workflow. ### Methods - **sendEmail(id, { template, from?, fromName?, replyTo? })** - Description: Send email. - **sendSms(id, { template?, message?, senderId? })** - Description: Send SMS. - **delay(id, { days?, hours?, minutes? })** - Description: Wait for a specified duration. - **condition(id, { field, operator, value, branches })** - Description: Create a conditional branch in the workflow. - **waitForEvent(id, { eventName, timeout? })** - Description: Pause workflow execution until a specific event occurs. - **waitForEmailEngagement(id, { emailStepId, engagementType, timeout? })** - Description: Wait for a specific email engagement (e.g., open, click). - **exit(id, { reason?, markAs? })** - Description: End the workflow execution. - **updateContact(id, { updates })** - Description: Modify contact fields (set, increment, decrement, append, remove). - **subscribeTopic(id, { topicId, channel? })** - Description: Subscribe a contact to a topic. - **unsubscribeTopic(id, { topicId, channel? })** - Description: Unsubscribe a contact from a topic. - **webhook(id, { url, method?, headers?, body? })** - Description: Make an external webhook call. - **cascade(id, { channels })** - Description: Orchestrate cross-channel communication. Stops when engagement is detected. ``` -------------------------------- ### Initialize Email Service and Configure Domain Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Provides bash commands to initialize the email service, add a domain, retrieve DKIM records, and verify the domain. This is a common workflow for setting up email sending capabilities with WRAPS, including DNS record configuration. ```bash npx @wraps.dev/cli email init npx @wraps.dev/cli email domains add -d yourapp.com npx @wraps.dev/cli email domains get-dkim -d yourapp.com # Add CNAME records to DNS provider npx @wraps.dev/cli email domains verify -d yourapp.com npm install @wraps.dev/email ``` -------------------------------- ### Initialize CDN Infrastructure with Wraps CLI Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms.txt This command initializes a CDN stack using S3 and CloudFront via the Wraps CLI. It automates the deployment of AWS services for content delivery. ```bash npx @wraps.dev/cli cdn init ``` -------------------------------- ### Show SMS Infrastructure Details (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Displays detailed information about the deployed SMS infrastructure. This helps in understanding the current configuration and status of the SMS service. ```bash wraps sms status ``` -------------------------------- ### Configuration Presets - Email Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Predefined configuration options for email services with associated costs and features. ```APIDOC ## Configuration Presets - Email ### Description Predefined configuration options for email services with associated costs and features. | Preset | Monthly Cost | Features | |------------|--------------|-------------------------------------------------------------------------| | starter | ~$0.05 | Open/click tracking, bounce/complaint suppression | | production | ~$2-5 | + Real-time event tracking, 90-day history, reputation metrics | | enterprise | ~$50-100 | + Dedicated IP, 1-year history, all 10 SES event types | ``` -------------------------------- ### Initialize Wraps SMS Client Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Initializes the WrapsSMS client instance. Requires region and credential configuration to authenticate with the service. ```typescript import { WrapsSMS } from '@wraps.dev/sms'; const sms = new WrapsSMS({ region: 'us-east-1', credentials: { accessKeyId: '...', secretAccessKey: '...' }, }); ``` -------------------------------- ### Connect to Wraps Platform (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Connects your local environment or AWS account to the Wraps Platform. This establishes communication for managing services. ```bash wraps platform connect ``` -------------------------------- ### Wraps CLI Command Reference for Email Service Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Lists available commands for managing the email service infrastructure deployed by Wraps. These commands cover initialization, connection to existing SES, status checks, deliverability audits, domain verification, configuration updates, upgrades, restoration, and destruction of email resources. ```bash wraps email init Deploy email infrastructure wraps email connect Connect to existing SES wraps email status Show infrastructure details wraps email check [domain] Deliverability audit (DKIM, SPF, DMARC, blacklists, TLS) wraps email verify Verify domain DNS records wraps email config Apply CLI updates to infrastructure wraps email upgrade Add features (tracking, history, dedicated IP) wraps email restore Restore from saved metadata wraps email destroy Remove all email infrastructure ``` -------------------------------- ### Initialize Inbound Email Receiving (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Enables inbound email receiving functionality using the Wraps CLI. This command sets up the necessary infrastructure for receiving emails. ```bash wraps email inbound init ``` -------------------------------- ### Trigger Types Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Defines the events that can initiate a workflow. ```APIDOC ## Trigger Types ### Description Defines the events that can initiate a workflow. ### Types - **contact_created**: Triggered when a new contact is added. - **contact_updated**: Triggered when contact fields are changed. - **event**: Triggered by a custom event (requires `eventName`). - **segment_entry**: Triggered when a contact enters a segment (requires `segmentId`). - **segment_exit**: Triggered when a contact exits a segment (requires `segmentId`). - **schedule**: Triggered based on a cron schedule (requires `schedule` cron expression, optional `timezone`). - **api**: Triggered via an API call. - **topic_subscribed**: Triggered when a contact subscribes to a topic (requires `topicId`). - **topic_unsubscribed**: Triggered when a contact unsubscribes from a topic (requires `topicId`). ``` -------------------------------- ### Connect and Upgrade Existing SES Configuration Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Bash commands to connect an existing AWS SES configuration to WRAPS and then upgrade it. This is useful for migrating existing email infrastructure to leverage WRAPS features. ```bash npx @wraps.dev/cli email connect npx @wraps.dev/cli email upgrade ``` -------------------------------- ### Deploy SMS Infrastructure (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Deploys the necessary infrastructure for the SMS service. This command sets up the resources required for sending and managing SMS messages. ```bash wraps sms init ``` -------------------------------- ### Show CDN Infrastructure Details (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Displays detailed information about the deployed CDN infrastructure. This provides insights into the configuration and status of your CDN. ```bash wraps cdn status ``` -------------------------------- ### Show Required IAM Permissions (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Displays the necessary IAM permissions required for Wraps to function correctly. This is helpful for setting up appropriate access controls. ```bash wraps permissions ``` -------------------------------- ### Compile and Push Email Templates (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Compiles email templates and pushes them to AWS SES and the Wraps dashboard. This command deploys your templates for use in email sending. ```bash wraps email templates push ``` -------------------------------- ### Deploy CDN Infrastructure (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Deploys the Content Delivery Network (CDN) infrastructure, typically involving S3 and CloudFront. This command sets up resources for efficient content delivery. ```bash wraps cdn init ``` -------------------------------- ### Check Telemetry Status (Bash) Source: https://github.com/wraps-team/wraps/blob/main/docs/telemetry.md This command demonstrates how to check the current status of Wraps telemetry. It shows whether telemetry is enabled or disabled and points to the configuration file. The output also provides instructions on how to enable telemetry. ```bash wraps telemetry status ``` -------------------------------- ### Initialize WRAPS Email with Optional Features Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Initializes the WRAPS Email client, enabling optional features like inbox and events by providing S3 bucket and DynamoDB table names respectively. Suppression is always available. ```typescript const email = new WrapsEmail({ inboxBucketName: 'my-inbox-bucket', // enables email.inbox historyTableName: 'my-events-table', // enables email.events }); ``` -------------------------------- ### Manage Inbound Email Infrastructure via CLI Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Commands for initializing, monitoring, and managing inbound email infrastructure using the Wraps CLI. These commands handle deployment, DNS verification, and infrastructure cleanup. ```bash wraps email inbound init # Deploy inbound email infrastructure wraps email inbound status # Check inbound status wraps email inbound verify # Verify MX DNS records wraps email inbound test # Send test and verify receipt wraps email inbound destroy # Remove inbound infrastructure ``` -------------------------------- ### Configure Platform and Brand Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Defines organization-wide settings and visual branding. Used to standardize communication styles and environment configurations. ```typescript import { defineConfig, defineBrand } from '@wraps.dev/client'; export default defineConfig({ org: 'my-org', region: 'us-east-1' }); export default defineBrand({ companyName: 'My Company', colors: { primary: '#6366f1' } }); ``` -------------------------------- ### Sync SMS Infrastructure (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Synchronizes the SMS infrastructure with the desired state. This command ensures that the deployed resources match the configuration. ```bash wraps sms sync ``` -------------------------------- ### Show Authentication Status (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Displays the current authentication status with the Wraps Platform. This command helps verify if you are logged in and your session details. ```bash wraps auth status ``` -------------------------------- ### Wraps CLI Command Reference for Email Domains Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Details the commands for managing email domains within the Wraps ecosystem. This includes adding domains to SES, configuring DKIM, listing domains, retrieving DKIM tokens, verifying DNS records (DKIM, SPF, DMARC), and removing domains. ```bash wraps email domains add Add domain to SES (configures DKIM) wraps email domains list List all domains with status wraps email domains get-dkim Get DKIM tokens for DNS wraps email domains verify Verify DKIM, SPF, DMARC wraps email domains remove Remove domain from SES ``` -------------------------------- ### Process Inbound Email via TypeScript SDK Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Demonstrates how to initialize the WrapsEmail client and interact with an S3-backed inbox. Includes methods for listing messages, retrieving content, and performing automated forwarding or replies. ```typescript const email = new WrapsEmail({ inboxBucketName: 'my-inbox-bucket' }); if (email.inbox) { const messages = await email.inbox.list({ maxResults: 20 }); const msg = await email.inbox.get(messageId); await email.inbox.forward(messageId, { to: 'other@example.com', from: 'me@example.com' }); await email.inbox.reply(messageId, { from: 'me@example.com', html: '

Reply

' }); } ``` -------------------------------- ### Remove All Infrastructure (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Removes all infrastructure deployed by Wraps. Use this command with caution as it will delete all associated resources. ```bash wraps destroy ``` -------------------------------- ### AWS SES Client Authentication for WrapsEmail Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Demonstrates how to initialize `WrapsEmail` using a pre-configured AWS SES client. This method bypasses other credential resolution steps, providing the highest priority for authentication. It's useful when you have specific AWS client configurations or shared clients. ```typescript import { SESClient } from '@aws-sdk/client-ses'; const sesClient = new SESClient({ /* custom config */ }); const email = new WrapsEmail({ client: sesClient }); // Bypasses all other credential resolution ``` -------------------------------- ### Define Automated Workflows Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Creates automated communication sequences using triggers, delays, and conditional logic. Allows for complex user engagement paths. ```typescript import { defineWorkflow, sendEmail, delay, condition, exit } from '@wraps.dev/client'; export default defineWorkflow({ name: 'Welcome Sequence', trigger: { type: 'contact_created' }, steps: [ sendEmail('welcome', { template: 'welcome-email' }), delay('wait', { days: 1 }), condition('check', { field: 'contact.hasActivated', operator: 'equals', value: true, branches: { yes: [exit('done')], no: [sendEmail('reminder', { template: 'activate' })] } }), ], }); ``` -------------------------------- ### Send Test Email via SES Simulator (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Sends a test email using the AWS SES simulator. This command is useful for testing email sending functionality without actually delivering emails. ```bash wraps email test ``` -------------------------------- ### Send Test SMS (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Sends a test SMS message to verify the SMS service functionality. This is useful for quick checks and troubleshooting. ```bash wraps sms test ``` -------------------------------- ### Test Inbound Email Receipt (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Sends a test email and verifies its successful receipt. This command is useful for troubleshooting and confirming that inbound email is working correctly. ```bash wraps email inbound test ``` -------------------------------- ### Run Email Deliverability Audit Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt A bash command to perform a deliverability audit for a given domain. This check assesses critical email sending configurations such as DKIM, SPF, DMARC, MX TLS, and blacklist status to ensure optimal email delivery rates. ```bash npx @wraps.dev/cli email check yourapp.com # Checks DKIM, SPF, DMARC, MX TLS, blacklists ``` -------------------------------- ### Perform Deliverability Audit (Email) (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Conducts a deliverability audit for a given domain, checking DKIM, SPF, DMARC records, and blacklist status. This helps ensure your emails reach the inbox. ```bash wraps email check [domain] ``` -------------------------------- ### Push Email Workflows to Wraps Platform (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Pushes your defined email workflows to the Wraps Platform. This makes your workflows available for execution. ```bash wraps email workflows push ``` -------------------------------- ### Check CDN DNS and Certificate Status (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Verifies the DNS and SSL/TLS certificate status for the CDN. This is essential for ensuring secure and reliable content delivery. ```bash wraps cdn verify ``` -------------------------------- ### Destroy SMS Infrastructure (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Removes all infrastructure associated with the SMS service. Use this to clean up SMS-related resources. ```bash wraps sms destroy ``` -------------------------------- ### Send Email with Wraps TypeScript SDK Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Demonstrates how to send emails using the Wraps TypeScript SDK for email services. This SDK abstracts the complexities of AWS SES, allowing for straightforward email sending with basic parameters like 'from', 'to', 'subject', and 'html' content. ```typescript import { WrapsEmail } from '@wraps.dev/email'; const email = new WrapsEmail(); await email.send({ from: 'hello@yourapp.com', to: 'user@example.com', subject: 'Welcome!', html: '

Hello from Wraps!

', }); ``` -------------------------------- ### Explicit Credentials Authentication for WrapsEmail Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Illustrates initializing `WrapsEmail` with explicit AWS credentials, either statically defined or provided by a function. This method allows for direct control over `accessKeyId`, `secretAccessKey`, and `region`, or can integrate with credential provider functions for dynamic credential management. ```typescript // Static credentials const email = new WrapsEmail({ credentials: { accessKeyId: process.env.AWS_ACCESS_KEY_ID!, secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!, }, region: 'us-east-1', }); // Credential provider function (e.g., from Vercel OIDC helper) const email = new WrapsEmail({ credentials: myCredentialProvider, // AwsCredentialIdentityProvider }); ``` -------------------------------- ### Upgrade SMS Features (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Upgrades the features or capabilities of the SMS service. This command allows you to enhance your SMS service with new functionalities. ```bash wraps sms upgrade ``` -------------------------------- ### Verify Destination Phone Number (SMS Sandbox) (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Verifies a destination phone number within the SMS sandbox environment. This is typically used for testing purposes before engaging with live numbers. ```bash wraps sms verify-number ``` -------------------------------- ### Add Custom Domain to CDN (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Adds a custom domain to your CDN configuration. This allows you to serve content from your own domain name via the CDN. ```bash wraps cdn upgrade ``` -------------------------------- ### SMS Utility Functions Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Helper functions for validating phone numbers, calculating message segments, and sanitizing phone number formats. ```typescript import { calculateSegments, validatePhoneNumber, sanitizePhoneNumber } from '@wraps.dev/sms'; const segments = calculateSegments('Hello!'); validatePhoneNumber('+14155551234', 'to'); const cleanNumber = sanitizePhoneNumber('(415) 555-1234'); ``` -------------------------------- ### Manage SMS Numbers and Opt-Outs Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Provides functionality to list, retrieve, and manage phone numbers and user opt-out statuses. Essential for compliance and contact management. ```typescript const numbers = await sms.numbers.list(); const number = await sms.numbers.get('phone-number-id'); await sms.optOuts.check('+14155551234'); await sms.optOuts.add('+14155551234'); ``` -------------------------------- ### Destroy CDN Infrastructure (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Removes all infrastructure related to the CDN service. Use this command to clean up CDN resources. ```bash wraps cdn destroy ``` -------------------------------- ### Send SMS Messages Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Methods for sending individual SMS messages or batching multiple messages. Supports transactional and promotional message types with optional metadata. ```typescript const result = await sms.send({ to: '+14155551234', message: 'Hello!', messageType: 'TRANSACTIONAL' }); const batchResult = await sms.sendBatch({ messages: [ { to: '+14155551234', message: 'Hello Alice!' }, { to: '+14155555678', message: 'Hello Bob!' }, ], messageType: 'TRANSACTIONAL', }); ``` -------------------------------- ### Validate Email Workflow Definitions (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Validates the definitions of your email workflows. This command checks for syntax errors and logical inconsistencies in your workflow configurations. ```bash wraps email workflows validate ``` -------------------------------- ### Manage Email Templates using WRAPS Email API Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Provides functions to create, update, retrieve, list, and delete email templates. Templates can be created from HTML/text or React components. ```typescript await email.templates.create({ name, subject, html, text? }); await email.templates.createFromReact({ name, subject, react }); await email.templates.update({ name, subject?, html?, text? }); await email.templates.get(name); // Returns template details await email.templates.list(); // Returns template metadata[] await email.templates.delete(name); ``` -------------------------------- ### Clear Stored Credentials (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Logs out from the Wraps Platform by clearing stored authentication credentials. Use this to revoke access on the current machine. ```bash wraps auth logout ``` -------------------------------- ### Check Inbound Email Status (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Displays the current status of the inbound email receiving service. This helps in monitoring the health and operational state of the feature. ```bash wraps email inbound status ``` -------------------------------- ### cascade() — Cross-Channel Orchestration Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Orchestrates communication across multiple channels, stopping upon engagement. ```APIDOC ## cascade() — Cross-Channel Orchestration ### Description Tries channels in order and stops when engagement is detected. Returns `StepDefinition[]`. ### Example ```typescript import { defineWorkflow, cascade, sendEmail } from '@wraps.dev/client'; export default defineWorkflow({ name: 'Notify User', trigger: { type: 'event', eventName: 'payment_failed' }, steps: [ ...cascade('notify', { channels: [ { type: 'email', template: 'payment-failed', waitFor: { hours: 2 }, engagement: 'opened' }, { type: 'sms', template: 'payment-failed-sms' }, ], }), ], }); // Expands to: sendEmail → waitForEmailEngagement → condition (engaged?) → yes: exit → no: sendSms ``` ``` -------------------------------- ### OIDC Role Assumption Authentication for WrapsEmail Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Shows how to configure `WrapsEmail` for authentication using OIDC role assumption, commonly used in environments like Vercel, EKS, or GitHub Actions. It utilizes the `AWS_ROLE_ARN` environment variable and an optional `roleSessionName` for secure access to AWS resources. ```typescript const email = new WrapsEmail({ roleArn: process.env.AWS_ROLE_ARN, roleSessionName: 'my-app-session', // Optional, defaults to 'wraps-email-session' }); // Uses AssumeRoleWithWebIdentity via AWS_WEB_IDENTITY_TOKEN_FILE ``` -------------------------------- ### Send Templated Email using WRAPS Email API Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Sends an email using a pre-defined template. Requires 'from', 'to', 'template' name, and 'templateData' to populate the template. ```typescript await email.sendTemplate({ from: 'you@company.com', to: 'user@example.com', template: 'welcome', templateData: { name: 'Alice', url: 'https://...' }, }); ``` -------------------------------- ### Send SMS with Wraps TypeScript SDK Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Illustrates sending SMS messages using the Wraps TypeScript SDK for SMS services. This SDK simplifies the process of sending text messages via AWS, requiring only the recipient's phone number and the message content. ```typescript import { WrapsSMS } from '@wraps.dev/sms'; const sms = new WrapsSMS(); await sms.send({ to: '+14155551234', message: 'Your code is 123456', }); ``` -------------------------------- ### Register Toll-Free Number (SMS) (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Registers a toll-free number for use with the SMS service. This is a necessary step for sending messages from a dedicated toll-free number. ```bash wraps sms register ``` -------------------------------- ### Send Batch Emails using WRAPS Email API Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Sends multiple emails in a single batch request, up to 100 entries. Each entry can have unique content. Supports optional shared 'replyTo' and default 'tags'. ```typescript const result = await email.sendBatch({ from: 'you@company.com', entries: [ { to: 'alice@example.com', subject: 'Hi Alice', html: '

Hello Alice!

' }, { to: 'bob@example.com', subject: 'Hi Bob', html: '

Hello Bob!

' }, ], replyTo: 'support@company.com', tags: { campaign: 'welcome' }, }); // Returns: { results: BatchEntryResult[], successCount: number, failureCount: number } ``` -------------------------------- ### AWS SDK Default Chain Authentication for WrapsEmail Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Configures `WrapsEmail` to use the AWS SDK's default credential resolution chain. This is the lowest priority method and is recommended for most use cases, as it automatically resolves credentials from environment variables, shared credential files, ECS containers, or EC2 instance metadata. ```typescript const email = new WrapsEmail(); // Resolves: env vars -> ~/.aws/credentials -> ECS container -> EC2 instance metadata ``` -------------------------------- ### Destroy Inbound Email Infrastructure (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Removes the infrastructure associated with inbound email receiving. Use this command to clean up resources when inbound email is no longer needed. ```bash wraps email inbound destroy ``` -------------------------------- ### Update IAM Role for Platform Access (CLI) Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Updates the IAM role that grants the Wraps Platform access to your AWS resources. This command is used to manage permissions for the platform. ```bash wraps platform update-role ``` -------------------------------- ### Send Single Email using WRAPS Email API Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Sends a single email with various options including HTML, plain text, React components, CC/BCC, reply-to, tags, and attachments. Requires 'from', 'to', 'subject', and at least one of 'html', 'text', or 'react'. ```typescript await email.send({ from: 'you@company.com', // Required to: 'user@example.com', // Required (string or string[]) subject: 'Subject', // Required html: '

Hello

', // html, text, or react required text: 'Hello', // Plain text fallback react: , // React.email component cc: ['cc@example.com'], // Optional bcc: ['bcc@example.com'], // Optional replyTo: ['reply@example.com'], // Optional tags: { campaign: 'welcome' }, // Optional (SES tags) attachments: [{ filename: 'file.pdf', content: Buffer | string, contentType: 'application/pdf', }], }); // Returns: { messageId: string } ``` -------------------------------- ### Access Email Events using WRAPS Email API Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Allows retrieval of email event history, such as delivery status or bounces. Requires 'historyTableName' during initialization. Events are sorted by priority. ```typescript if (email.events) { await email.events.get(messageId); // Events sorted by priority await email.events.list({ accountId: '123456789012', maxResults: 50 }); } ``` -------------------------------- ### Send Bulk Templated Emails using WRAPS Email API Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Sends emails to multiple recipients using a single template, up to 50 destinations. Each destination can have specific template data. ```typescript await email.sendBulkTemplate({ from: 'you@company.com', template: 'weekly-digest', destinations: [ { to: 'alice@example.com', templateData: { name: 'Alice' } }, { to: 'bob@example.com', templateData: { name: 'Bob' } }, ], }); ``` -------------------------------- ### Define Workflow with Cascade for Cross-Channel Orchestration Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Defines a workflow that uses the `cascade` function to orchestrate notifications across multiple channels. It attempts to send an email and waits for an open event, falling back to SMS if no engagement occurs within a specified time. This demonstrates sequential channel execution with engagement-based branching. ```typescript import { defineWorkflow, cascade, sendEmail } from '@wraps.dev/client'; export default defineWorkflow({ name: 'Notify User', trigger: { type: 'event', eventName: 'payment_failed' }, steps: [ ...cascade('notify', { channels: [ { type: 'email', template: 'payment-failed', waitFor: { hours: 2 }, engagement: 'opened' }, { type: 'sms', template: 'payment-failed-sms' }, ], }), ], }); // Expands to: sendEmail → waitForEmailEngagement → condition (engaged?) → yes: exit → no: sendSms ``` -------------------------------- ### Import WRAPS Email Error Types Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Imports various error types from the '@wraps.dev/email' package, including a base error class and specific errors for validation, SES, DynamoDB, and batch operations. ```typescript import { ValidationError, SESError, DynamoDBError, BatchError, WrapsEmailError } from '@wraps.dev/email'; // WrapsEmailError: base class for all email errors // ValidationError: invalid input (bad email, missing fields) // .field?: string - which field failed // .message: string // SESError: AWS SES error (rate limit, unverified sender) // .code: string - 'MessageRejected', 'Throttling', etc. // .requestId: string // .retryable: boolean // DynamoDBError: email history read/write error // .code: string, .requestId: string, .retryable: boolean // BatchError: partial failure in sendBatch() // .results: BatchEntryResult[] - per-entry results // .successCount: number // .failureCount: number ``` -------------------------------- ### Manage Email Suppression List using WRAPS Email API Source: https://github.com/wraps-team/wraps/blob/main/apps/website/public/llms-full.txt Provides functionality to manage the email suppression list, allowing retrieval, addition, removal, and listing of suppressed email addresses with reasons like 'BOUNCE'. This feature is always available. ```typescript await email.suppression.get(emailAddress); await email.suppression.add(emailAddress, 'BOUNCE'); await email.suppression.remove(emailAddress); await email.suppression.list({ reason: 'BOUNCE', maxResults: 100 }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.