feat: Implement unsubscribe link for marketing automation [31188f42]
This commit introduces a new unsubscribe feature to allow contacts to opt-out from marketing automation. Key changes include: - Database schema migration: Added (UUID) to the model. - Data population: Implemented a script to assign unique tokens to existing contacts. - API endpoint: Created a public GET endpoint to handle opt-out requests. - Automation: New contacts automatically receive an unsubscribe token upon creation. - Integration: The full unsubscribe link is now returned via the provisioning API for storage in SuperOffice UDFs (ProgID: SuperOffice:9). - Documentation: Updated and to reflect the new feature and its integration requirements. - Added for quick overview and next steps.
This commit is contained in:
@@ -89,6 +89,17 @@ def migrate_tables():
|
||||
""")
|
||||
logger.info("Table 'reported_mistakes' ensured to exist.")
|
||||
|
||||
# 4. Update CONTACTS Table (Two-step for SQLite compatibility)
|
||||
logger.info("Checking 'contacts' table schema for unsubscribe_token...")
|
||||
contacts_columns = get_table_columns(cursor, "contacts")
|
||||
|
||||
if 'unsubscribe_token' not in contacts_columns:
|
||||
logger.info("Adding column 'unsubscribe_token' to 'contacts' table...")
|
||||
cursor.execute("ALTER TABLE contacts ADD COLUMN unsubscribe_token TEXT")
|
||||
|
||||
logger.info("Creating UNIQUE index on 'unsubscribe_token' column...")
|
||||
cursor.execute("CREATE UNIQUE INDEX IF NOT EXISTS idx_contacts_unsubscribe_token ON contacts (unsubscribe_token)")
|
||||
|
||||
conn.commit()
|
||||
logger.info("All migrations completed successfully.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user