Can't seem to access and populate template on SendGrid via Apex
Hi,
I've successfully sent an email from SendGrid with parameters passed from SF using the following core code:
SendGrid sendgrid = new SendGrid('username', 'password');
SendGrid.email email = new SendGrid.Email();
email.addTo('[email protected]'); email.setFrom('[email protected]'); email.setSubject('Apex SendGrid Test');
SendGrid.SendGridResponse response = sendgrid.send(email);
I then created a template in SendGrid and attempted to send parameters to it from Salesforce using the following code:
SendGrid sendgrid = new SendGrid('username', 'password');
SendGrid.email email = new SendGrid.Email();
email.addFilter('templates', 'enable', '1'); email.addFilter('templates', 'template_id', '38e0b815-2551-4a9b-aa7a-e74db88329d4');
email.addTo('[email protected]'); email.setFrom('[email protected]'); email.setSubject('Apex SendGrid Test');
SendGrid.SendGridResponse response = sendgrid.send(email);
This processes ok within Salesforce but nothing happens when it gets passed to SendGrid. Any guidance would be much appreciated.
Thanks