Get the instructions to use the NodeJS SDK to upload data to the Vaultastic Active Store using the Vaultastic Mail Upload API.
- You should have your Vaultastic domain provisioned.
- You should have created the vaults in the Active Store to which you want to upload the data.
- You have got the API key from Mithi.
- You should have NodeJS version 14.5.0 or above.
- The following are the transitive dependencies and versions:
- npm - 7.5.2
- form-data - 4.0.0
- mailparser - 3.1.0
- uuid - 8.3.2
- winston - 3.3.3
- yargs - 16.2.0
- node-fetch - 2.6.1
- The following environment variables should be set:
- PRIMARY_DOMAIN: The primary domain name for filtering vaults from the mail.
- API_ENDPOINT_URL: ActiveStoreMailUploadAPI.vaultastic.com
- API_KEY: The API Key shared for uploading mail to v4.
To upload mail to a vault in the Active Store of your Vaultastic domain use the script: index.js
The command-line arguments are as follows:
-e <EmlFilePath> where <EmlFilePath> is the path of the EML file.
-m <MailContents> where <MailContents> are the mail contents
-r <Recipients> where <Recipients> are the comma-separated list of ids on the primary domain
-s <Sender> where the sender is an id on the primary domain
- Use either -e or -m option but not both. If both are used the -m value will be ignored.
- Use -r and -s only if the sender or recipient is not part of the mail headers From, To, CC or BCC.
Exit Codes and Messages
|0||Mail Successfully uploaded||N.A.|
|1||Unknown Exception||This is the exit code returned when there is no other specific exit code defined for the error that occurred. More Information can be found in the message/stack trace printed by nodeJS.|
|2||Misuse of shell builtins (UNIX reserved error)||Missing keyword or command, or permission problem (and diff return code on a failed binary file comparison)|
|3||Invalid number of arguments||an invalid number of arguments passed. Provide at least -i or -m.|
|4||Invalid Recipient||Invalid Recipient Email ID. Make sure the id passed on -r argument is a valid email id (or email ids are comma separated).|
|5||Failed to Upload mail to S3||Mail Failed to upload to s3 bucket. Check Error logs for the failed message.|
|6||Recipients not from PRIMARY_DOMAIN||
At least one recipient should be from the primary domain.
1. Check if PRIMARY_DOMAIN is correct OR
- No multi-domain support. That is recipient filtering based on multiple PRIMARY_DOMAIN values is not supported.
- Rate Limits: 10,000 Requests per second with 5000 Burst requests.
- Max Mail Size: 50MB
Vaultastic NodeJs SDK is developed to be used as a CLI tool as well as an external NodeJs API wrapper module for using Vaultastic mail upload APIs.
- Vaultastic NodeJs SDK as CLI Implementation
- Navigate to the root directory of the project folder in a PowerShell/terminal window.
- Run node index.js
- Implementation of VaultasticActiveStoreMailUpload-SDK as S3 triggered Lambda
- Memory Required: 128MB (for up to 5MB Mails) - more memory required as the mail content resides in the same process
- Lambda Timeout: 3 mins (180 seconds)
- Runtime: NodeJS 14.x
- Handler: index.handler
- Environment Variables:
- API_ENDPOINT_URL: https://vaultasticactivestoremailuploadapi.vaultastic.com
- API_KEY: <Your API KEY>
- PRIMARY_DOMAIN: <your primary domain name for filtering vaults from the mail>
- Make sure Lambda has Internet access. (for VPC Lambda see this: https://aws.amazon.com/premiumsupport/knowledge-center/internet-access-lambda-function/)
- Sample Code:
- Using the sample code given create a js file index.js
- Add this index.js to VaultasticActiveStoreMailUpload-NodeJS-SDK-1.0.2.zip
- Upload zip to Lambda Function with the above parameters.
- Upload mail to S3 and it should trigger the lambda to upload mail to Vaultastic Active Store.