-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
This is part of a method I wrote to send a transactional email using a template. The signature for setParams specifies that you pass a java.lang.Object - I've tried passing manually-constructed JSON strings (as in the example below), and passing an array of brevo.Pair objects, but no mater what, I get an HTTP 400 response with a message "invalid params".
The documentation is far from clear on how to pass parameters using the Java API.
Thanks
--Steve
TransactionalEmailsApi apiInstance = new TransactionalEmailsApi();
SendSmtpEmail email = new SendSmtpEmail(); // SendSmtpEmail | Values to send a transactional email
email.setSubject(subject);
email.setTemplateId(templateId);
email.setSender(sender);
email.addToItem(recipient);
email.setParams("{confirmationURL: \"https://example.com\"}");
System.out.println(email);
BrevoApiResponse response = null;
try {
CreateSmtpEmail result = apiInstance.sendTransacEmail(email);
response = new BrevoApiResponse(result.getMessageId());
} catch (ApiException exc ) {
System.err.println("Exception when sending email");
System.err.println(exc.getClass().getName());
System.err.println(BrevoUtils.getMessageFromException(exc));
}Metadata
Metadata
Assignees
Labels
No labels