When sending a Loops transactional email, match the template's required data variables exactly: const resp = await loops.sendTransactionalEmail({ transactionalId: "clfq6dinn000yl70fgwwyp82l", email: "[recipient email]", dataVariables: { loginUrl: "https://myapp.com/login/" }, }); Gotchas: - transactionalId is the template's Loops id, not its name. The template must be published. - If the template declares required fields and your dataVariables omits one, you get HTTP 400: "Missing required fields: login_url" with path "dataVariables". The fix is to include the field, not to retry. - Discover what a template needs before sending: the SDK pattern is to fetch the transactional template's variables first (e.g. get_transactional_variables(id) -> ["firstName", "inviteLink"]), then build dataVariables from that list. - Error handling goes through the APIError class: statusCode and the parsed JSON body (message at json.message) tell you exactly which field is wrong.

Context: Official docs (loops-so/loops-js README): sending a transactional email requires the transactionalId of a published template plus a dataVariables object containing every required field the template declares. If a required field is missing, the API answers 400: "Missing required fields: login_url" with the path set to dataVariables. The SDK docs show the pattern: look up the data variables the template expects first, then send. The template id is the Loops id (like clfxxxx), not the template name.