Access node sdk
Install
-
yarn add @pureprofile/access-node-sdk
||npm install -s @pureprofile/access-node-sdk
Docs
https://github.com/pureprofile-warp/access-node-sdk/blob/master/docs/index.html
Promise.<Array.<{rcpt: String, message_id: String}>>
sendEmail ⇒ Note: Params inside [] are optional
Returns: Promise.<Array.<{rcpt: String, message_id: String}>>
- The request promise which resolves with an object if the send was success or rejects if there was an error.
Param | Type | Default | Description |
---|---|---|---|
conf | Object |
The config object | |
[conf.endpoint] | string |
Email API endpoint url, can be also autoresolved from env variables | |
conf.accessKey | string |
Your unique accessKey | |
conf.secret | string |
Your secret | |
request | Object |
The request object | |
[request.template] | string |
The GUID of the template | |
[request.html] | string |
The HTML of the template | |
request.to | Array.<{recipient: String, panel: String, type: ('email'|'user'|'accoh')}> |
The emails or the GUIDs of the recipients. | |
request.from | string |
The email address that should send the emails. | |
request.fromName | string |
The name which should send the email. | |
request.type |
'trans' | 'market'
|
The type of the email. | |
request.replyTo | string |
The email address that should receive the replies. | |
request.subject | string |
The subject of the email. | |
[request.vars] | Object |
Extra vars that you want to pass to the argument. | |
[request.priority] | number |
The priority of the emails. | |
[request.scheduled] | string |
An ISO timestamp if you want to schedule the email for a specific date. | |
[request.addUnsubscribeLink] | boolean |
false |
Include an unsubscribe link to the email. |
Example
sendEmail({
acessKey: "",
secret: ""
}, {
template: "cada42b4-6cca-4b44-9561-ff29e8dfdbd5",
to: [
{
"recipient": "005cf5c8-ad23-4750-b8a0-b1ecd5bc6ec8",
"panel": "81b84740-d250-4470-89f8-f3299d8e0e6e",
"type": "accoh"
},{
"recipient": "de4e1e8b-1fe9-4800-a815-ce940206815d",
"panel": "81b84740-d250-4470-89f8-f3299d8e0e6e",
"type": "user"
},{
"recipient": "chris.sylaios@gmail.com",
"panel": "81b84740-d250-4470-89f8-f3299d8e0e6e",
"type": "email"
}
],
from: "no-reply-dev@pureprofile.com",
fromName: "Pureprofile",
type: "trans",
replyTo: "info@pureprofile.com",
subject: "test subject"
});