After 12 hours of trying I am completely at a loss as to how to implement the code to retrieve a list of sendGrid templates based on the info provided in the velo documentation
https://www.wix.com/velo/reference/velo-package-readmes/sendgrid-templates
I have no problem using the emailsend with sendGrid so I am familiar with secrets etc, but I am lost on this one.
I have installed the npm templates package as instructed, setup a new API key and config.json file as instructed, but just can’t seem to get the getEmailTemplates() function to retrieve the data.
My jsw file looks like this
import wixSecretsBackend from ‘wix-secrets-backend’ ;
import { sendInstruction } from ‘backend/email-templates.js’ ;
export async function testTemplateGrab () {
const sendGridSecret = JSON . parse ( **await** wixSecretsBackend . getSecret ( 'velo-sendgrid-api-key' ));
const key = sendGridSecret.key ;
//console.log(key);
**return** sendInstruction ( key )
}
Where I’m struggling is how to implement the getEmailTemplates() function in the email-templates.js file in order to retrieve the data for the templates…
I’m relatively new to Velo, so please excuse my ignorance. Any help would be greatly appreciated.
Thank you in advance