Skip to content

Can't use any variables #34

@ghost

Description

I can't seem to get custom tokens variables to work in the subject/body.

My main use case:
I want to specify the subject from the API. How I send the custom tokens work in the vanilla templating system, but Twig doesn't get them.
Template:
Subject: {% TWIG_BLOCK %}{% subject %}{% END_TWIG_BLOCK %}
Body:

{content}

{signature}

{unsubscribe_text}

Request:
POST https://mautic.varigergo.hu/api/emails/EMAIL_ID/contact/CONTACT_ID/send

{ "tokens": { "subject": "xxxx", "content": "xxxxx" } }

Error:

[2023-04-09 13:37:09] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\SyntaxError: "Unknown "subject" tag in "__string_template__63495053935a5082041ab9769b6c41ccf06b0329b0eeb8cb21a49cc072432a2c" at line 1." at /var/www/html/vendor/twig/twig/src/Parser.php line 160 {"exception":"[object] (Twig\\Error\\SyntaxError(code: 0): Unknown \"subject\" tag in \"__string_template__63495053935a5082041ab9769b6c41ccf06b0329b0eeb8cb21a49cc072432a2c\" at line 1. at /var/www/html/vendor/twig/twig/src/Parser.php:160)"} {"hostname":"ae6df2b3b54a","pid":50}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions