used to process HTML to PDF requests
Using npm:
$ npm install
Requires these process environment variables to be set
EMAIL
- this is the email that can be used to access the public REST APIPASSWORD
- this is the password that can be used to access the public REST APISLOWDOWN
- this is set the delay in milliseconds that the app applies between requests
The following environment variables are placeholders required when job: html-to-df is configured with the connection to docrapter and ftp. Note that FTP details will need be passed as JSON (not shown here) to allow for routing brand to appropriate location.
FTP_HOST
- this is SFTP host, without theSFTP://
prefixFTP_USERNAME
- this is SFTP usernameFTP_PASSWORD
- this is SFTP passwordFTP_PROTOCOL
- this is SFTP protocol most likely this will have valuesftp
FTP_PORT
- this is SFTP port, most likely will have value22
DOCRAPTER_KEY
- this is the key for using docrapter, for testing useYOUR_API_KEY_HERE
DOCRAPTER_TEST
- this is set totrue
when testing to keep usage of billed service to a minimum
Refer to Procfile
Notes:
[endpoint]
- refer to Heroku app for end endpoint[request-email]
- application user email[request-password]
- application user password
The following environment variables are placeholders required when job: html-to-df is configured with the connection to docrapter and ftp.
[doc-brand]
- used to route PDF to FTP location[doc-html-url]
- URL of source HTML
To change credentials for user, refer to following code that references process environment variables in the src/app.js
.
app.service('users').create({
email: process.env.USERNAME,
password: process.env.PASSWORD
});
Used to authenticate a user and get an accessToken.
accessToken is used to authenticate requests.
POST [endpoint]/authenticate
{
"strategy": "local",
"email":"[request-email]",
"password":"[request-password]"
}
On success body of request returns accessToken
.
Note that
[request-email]
contains the contents ofprocess.env.USERNAME
[request-password]
contains the contents ofprocess.env.PASSWORD
Used to add a HTML document to be converted to PDF and stored to FTP.
accessToken is used to authenticate requests.
POST [endpoint]/pdf
In Auth for Bearer Token use accessToken.
{
"brand": "[doc-brand]",
"html":"[doc-html-url]"
}
Set environment variable SERVER
to name of service used for testing.
Test is limited to functionality as per /test/app.test.js
Note also testLoad.js
which was used for testing app for load.
These tests are of little or no use as testing needs to include SFMC payload and services.