Generating Email with the JavaScript API

With the Webvanta system, JavaScript on your web pages can trigger the generation of email. Email generation can also be set to run once a day (such as for daily updates).

(Note: the email generation feature is available only on certain plans.)

Email Generation API

To send an email, call the email generation JavaScript API by posting to the email endpoint. The endpoint is:

/admin/api/v2/email/<webvanta api key>/send

The Webvanta API key is custom to each site. Contact support to get your key.

Here's an example of an email generation:

               pid: 1440169,
               subject: "Your document is attached",
               from: "",
               path: "/document-email",
               item: 1234567,
               attachments: [{filename: myfile.pdf, file_path: /documents, content_type: "application/pdf"}]

The Webvanta email system is intended only for transactional emails. You can send emails only to specific people identified by their PID (profile id).

The parameters are:

  • pid: profile ID of recipient
  • subject: text for subject
  • from: email address message appears to come from
  • path: location of the page for the HTML body of the email
  • item: ID of the item to use for the HTML body if needed
  • attachments: array of zero or more JavaScript objects that specify the file(s) to attach to the email
    • filename: filename to use for attachment component
    • file_path: full path to the asset to attach. This can be any publically accessible path for the account
    • content_type: The MIME type of the file being attached

The post to the endpoint will return a standard Job Status ID for tracking progress. The value will be either "ok" or an error message.

Email pages can use the optional {{item}} replacement syntax for ItemPages as for PDFs