crm-email

Send a CRM test/preview email

Admin-only. Sends a single test/preview email to to_email so an admin can verify the content and personalization before scheduling the real send.

post/api/campaigns/send-test-email

Request body

to_emailstring

Recipient address for the test/preview send.

recipient_emailsstring[]

Explicit recipient email addresses (e.g. from an uploaded CSV). Take priority over the filters. Emails with no matching user are still emailed, with an empty first name. Capped at 50000 addresses per request.

patient_statesstring[]

Stato paziente filters. OR-combined with registration_reasons.

patient_filtersstring[]

Deprecated alias of patient_states (kept for the current frontend payload).

registration_reasonsstring[]

Motivo iscrizione filters (users.registration_reason). OR-combined with patient_states.

email_subjectstring nullable

Subject for the email. Falls back to a generated test subject when empty.

email_htmlstring nullable

Composed HTML body (template with image placeholders already replaced by URLs). Used as the test send body when provided.

template_pathstring nullable

Storage path of the uploaded template under public/templates/ (audit/reuse).

placeholder_imagesobject

Map of placeholder name -> image public URL used to compose email_html (audit/reuse).

Response

Successful Response

statusstring required

Whether the task was enqueued.

to_emailstring required

Test/preview recipient address.

subjectstring required

Subject used for the email.

campaign_keystring required

Unique campaign key used for dedupe/audit.

task_idstring nullable

Celery task id, if enqueue succeeded.

resolved_fromstring

'selection' when an explicit recipient_emails list was used, otherwise 'filters'.

recipient_countinteger

Number of patients matched by the selection/filters.

sent_countinteger

Number of addresses actually enqueued (1 for a test send).

Changes