
Apify Email Signature Generator
Pricing
Pay per usage
Go to Store

Apify Email Signature Generator
Generates a standardized email signature for Apify team members, using provided details.
4.5 (4)
Pricing
Pay per usage
24
Total users
97
Monthly users
5
Runs succeeded
>99%
Last modified
2 months ago
build/generateHTML.js
1"use strict";2Object.defineProperty(exports, "__esModule", { value: true });3const types_1 = require("./types");4const sanitizeUrl = (url) => {5 if (!/^https?:\/\//i.test(url)) {6 return 'https://' + url;7 }8 return url;9};10const generateLinksSection = (input) => {11 var _a;12 const urls = [13 { key: "Twitter", value: input.twitterUrl },14 { key: "LinkedIn", value: input.linkedInUrl },15 { key: "Github", value: input.githubUrl },16 { key: "Book a meeting", value: input.hubspotUrl },17 ...((_a = input.otherUrls) !== null && _a !== void 0 ? _a : []),18 ];19 const urlsHtml = urls20 .filter((u) => u.value)21 .map((u) => `<a href="${sanitizeUrl(u.value)}" style="color: #4990ff; text-decoration: none;">${u.key}</a>`)22 .join(" | ");23 return `<div style="line-height: 18px;">${urlsHtml}</div>`;24};25const typeToHtml = (input) => ({26 [types_1.EmailSignatureType.Gmail]: `<div style="font-family: Verdana, sans-serif; font-size: 12px; font-weight: 400; color: #8d92af;">27 <div style="font-weight: 600; line-height: 18px; color: #272c3d;">${input.fullName}</div>28 <div style="line-height: 18px;">${input.position}</div>29 <div style="display: flex; align-items: center;">30 <a href="https://apify.com/">31 <img src="https://apify.com/ext/logo-for-signatures.png" 32 alt="Apify" style="margin-top: 12px; width:115px; margin-bottom: 12px;">33 </a>34 </div>35 ${input.phoneNumber36 ? `<div style="line-height: 18px;">${input.phoneNumber}</div>`37 : ""}38 ${generateLinksSection(input)}39 ${input.apifyUrl40 ? `<a href="${sanitizeUrl(input.apifyUrl)}" style="color: #4990ff; 41 text-decoration: none;"><div style="line-height: 18px;">${input.apifyUrlLabel || 'Apify Profile'}</div></a>`42 : ""}43 <div style="line-height: 18px; margin-top: 12px;"><a href="https://apify.com" style="color: #4990ff; 44 text-decoration: none; font-weight: 600;">Apify.com</a>${input.shouldDisplayHiring45 ? ` | <a href="https://apify.com/jobs" style="color: #4990ff; 46 text-decoration: none;">We're hiring</a>`47 : ""}48 </div>49 50 ${input.shouldDisplayG251 ? `<div style="display: flex; align-items: center;">52 <a href="https://www.g2.com/products/apify/reviews">53 <img src="https://apify.com/ext/g2badge.svg" 54 alt="G2 badge" style="margin-top: 12px; width:90px; margin-bottom: 12px;">55 </a>56 </div>`57 : ""}</div>`,58 [types_1.EmailSignatureType.Outlook]: `<div style="font-family: Verdana, sans-serif; font-size: 12px; font-weight: 400; color: #8d92af;">59 <div style="font-weight: 600; line-height: 18px; color: #272c3d;">${input.fullName}</div>60 <div style="line-height: 18px;">${input.position}</div>61 <br style="line-height: 12px;"> 62 <a href="https://apify.com/"><img src="https://apify.com/ext/logo-for-signatures.png" 63 alt="Apify" style="width: 115px;"></a>64 <br style="line-height: 12px;"> 65 ${input.phoneNumber66 ? `<div style="line-height: 18px;">${input.phoneNumber}</div>`67 : ""}68 ${generateLinksSection(input)}69 ${input.apifyUrl70 ? `<a href="${sanitizeUrl(input.apifyUrl)}" style="color: #4990ff; 71 text-decoration: none;"><div style="line-height: 18px;">${input.apifyUrlLabel || 'Apify Profile'}</div></a>`72 : ""}73 <br style="line-height: 12px;">74 <div style="line-height: 18px;"><a href="https://apify.com" style="color: #4990ff; 75 text-decoration: none; font-weight: 600;">Apify.com</a>${input.shouldDisplayHiring76 ? ` | <a href="https://apify.com/jobs" style="color: #4990ff; 77 text-decoration: none;">We're hiring</a>`78 : ""}79 </div>80 <br style="line-height: 12px;">81 ${input.shouldDisplayG282 ? `83 <a href="https://www.g2.com/products/apify/reviews">84 <img src="https://apify.com/ext/g2badge.svg" 85 alt="G2 badge" style="width:90px;">86 </a>`87 : ""}88</div>`,89});90exports.default = (input, type) => {91 const result = typeToHtml(input)[type];92 return result;93};
build/main.js
1"use strict";2Object.defineProperty(exports, "__esModule", { value: true });3const generateHTML_1 = require("./generateHTML");4const Apify = require("apify");5Apify.main(async () => {6 const input = (await Apify.getInput());7 await Apify.setValue("OUTPUT", generateHTML_1.default(input, input.type), { 'contentType': 'text/html; charset=utf-8' });8 console.log('Done!');9 console.log('Your email signature can be viewed in the Key-value store under the key "OUTPUT"');10});
build/types.js
1"use strict";2Object.defineProperty(exports, "__esModule", { value: true });3exports.EmailSignatureType = void 0;4var EmailSignatureType;5(function (EmailSignatureType) {6 EmailSignatureType["Gmail"] = "Gmail";7 EmailSignatureType["Outlook"] = "Outlook";8})(EmailSignatureType = exports.EmailSignatureType || (exports.EmailSignatureType = {}));
src/generateHTML.ts
1import { EmailSignatureInput, EmailSignatureType } from "./types";2
3const sanitizeUrl = (url) => {4 if (!/^https?:\/\//i.test(url)) {5 return 'https://' + url;6 }7 return url;8};9
10const generateLinksSection = (input: EmailSignatureInput) => {11 const urls = [12 { key: "Twitter", value: input.twitterUrl },13 { key: "LinkedIn", value: input.linkedInUrl },14 { key: "GitHub", value: input.githubUrl },15 { key: "Book a meeting", value: input.hubspotUrl },16 ...(input.otherUrls ?? []),17 ];18 const urlsHtml = urls19 .filter((u) => u.value)20 .map(21 (u) =>22 `<a href="${sanitizeUrl(u.value)}" style="color: #4990ff; text-decoration: none;">${u.key}</a>`23 )24 .join(" | ");25 return `<div style="line-height: 18px;">${urlsHtml}</div>`;26};27
28const typeToHtml = (input: EmailSignatureInput) => ({29 [EmailSignatureType.Gmail]: `<div style="font-family: Verdana, sans-serif; font-size: 12px; font-weight: 400; color: #8d92af;">30 <div style="font-weight: 600; line-height: 18px; color: #272c3d;">${input.fullName31 }</div>32 <div style="line-height: 18px;">${input.position}</div>33 <div style="display: flex; align-items: center;">34 <a href="https://apify.com/">35 <img src="https://apify.com/ext/logo-for-signatures.png" 36 alt="Apify" style="margin-top: 12px; width:115px; margin-bottom: 12px;">37 </a>38 </div>39 ${input.phoneNumber40 ? `<div style="line-height: 18px;">${input.phoneNumber}</div>`41 : ""42 }43 ${generateLinksSection(input)}44 ${input.apifyUrl45 ? `<a href="${sanitizeUrl(input.apifyUrl)}" style="color: #4990ff; 46 text-decoration: none;"><div style="line-height: 18px;">${input.apifyUrlLabel || 'Apify Profile'}</div></a>`47 : ""48 }49 <div style="line-height: 18px; margin-top: 12px;"><a href="https://apify.com" style="color: #4990ff; 50 text-decoration: none; font-weight: 600;">Apify.com</a>${input.shouldDisplayHiring51 ? ` | <a href="https://apify.com/jobs" style="color: #4990ff; 52 text-decoration: none;">We're hiring</a>`53 : ""54 }55 </div>56 57 ${input.shouldDisplayG258 ? `<div style="display: flex; align-items: center;">59 <a href="https://www.g2.com/products/apify/reviews">60 <img src="https://apify.com/ext/g2badge.svg" 61 alt="G2 badge" style="margin-top: 12px; width:90px; margin-bottom: 12px;">62 </a>63 </div>`64 : ""65 }</div>`,66 [EmailSignatureType.Outlook]: `<div style="font-family: Verdana, sans-serif; font-size: 12px; font-weight: 400; color: #8d92af;">67 <div style="font-weight: 600; line-height: 18px; color: #272c3d;">${input.fullName68 }</div>69 <div style="line-height: 18px;">${input.position}</div>70 <br style="line-height: 12px;"> 71 <a href="https://apify.com/"><img src="https://apify.com/ext/logo-for-signatures.png" 72 alt="Apify" style="width: 115px;"></a>73 <br style="line-height: 12px;"> 74 ${input.phoneNumber75 ? `<div style="line-height: 18px;">${input.phoneNumber}</div>`76 : ""77 }78 ${generateLinksSection(input)}79 ${input.apifyUrl80 ? `<a href="${sanitizeUrl(input.apifyUrl)}" style="color: #4990ff; 81 text-decoration: none;"><div style="line-height: 18px;">${input.apifyUrlLabel || 'Apify Profile'}</div></a>`82 : ""83 }84 <br style="line-height: 12px;">85 <div style="line-height: 18px;"><a href="https://apify.com" style="color: #4990ff; 86 text-decoration: none; font-weight: 600;">Apify.com</a>${input.shouldDisplayHiring87 ? ` | <a href="https://apify.com/jobs" style="color: #4990ff; 88 text-decoration: none;">We're hiring</a>`89 : ""90 }91 </div>92 <br style="line-height: 12px;">93 ${input.shouldDisplayG294 ? `95 <a href="https://www.g2.com/products/apify/reviews">96 <img src="https://apify.com/ext/g2badge.svg" 97 alt="G2 badge" style="width:90px;">98 </a>`99 : ""100 }101</div>`,102});103
104export default (input: EmailSignatureInput, type: EmailSignatureType) => {105 const result = typeToHtml(input)[type];106 return result;107};
src/main.ts
1import generateHTML from './generateHTML';2import { EmailSignatureInput } from './types';3const Apify = require('apify');4
5Apify.main(async () => {6 const input: EmailSignatureInput = (await Apify.getInput()) as any;7 await Apify.setValue('OUTPUT', generateHTML(input, input.type), {'contentType': 'text/html; charset=utf-8'});8 console.log('Done!');9 console.log('Your email signature can be viewed in the Key-value store under the key "OUTPUT"');10});
src/types.ts
1interface UrlWithLabel {2 key: string;3 value: string;4}5
6export interface EmailSignatureInput {7 fullName: string;8 position: string;9 phoneNumber?: string;10 twitterUrl?: string;11 linkedInUrl?: string;12 githubUrl?: string;13 hubspotUrl?: string;14 otherUrls?: UrlWithLabel[];15 apifyUrlLabel?: string;16 apifyUrl?: string;17 shouldDisplayHiring?: boolean;18 shouldDisplayG2?: boolean;19 type: EmailSignatureType;20}21
22export enum EmailSignatureType {23 Gmail = 'Gmail',24 Outlook = 'Outlook',25}
.editorconfig
root = true
[*]indent_style = spaceindent_size = 4charset = utf-8trim_trailing_whitespace = trueinsert_final_newline = trueend_of_line = lf
.eslintrc
{ "extends": "@apify"}
.gitignore
# This file tells Git which files shouldn't be added to source control
.ideanode_modules
apify_storage
Dockerfile
# First, specify the base Docker image. You can read more about# the available images at https://sdk.apify.com/docs/guides/docker-images# You can also use any other image from Docker Hub.FROM apify/actor-node:15
# Second, copy just package.json and package-lock.json since it should be# the only file that affects "npm install" in the next step, to speed up the buildCOPY package*.json ./
# Install NPM packages, skip optional and development dependencies to# keep the image small. Avoid logging too much and print the dependency# tree for debuggingRUN npm --quiet set progress=false \ && npm install --only=prod --no-optional \ && echo "Installed NPM packages:" \ && (npm list || true) \ && echo "Node.js version:" \ && node --version \ && echo "NPM version:" \ && npm --version
# Next, copy the remaining files and directories with the source code.# Since we do this after NPM install, quick build will be really fast# for most source file changes.COPY . ./
# Optionally, specify how to launch the source code of your actor.# By default, Apify's base Docker images define the CMD instruction# that runs the Node.js source code using the command specified# in the "scripts.start" section of the package.json file.# In short, the instruction looks something like this:## CMD npm start
INPUT_SCHEMA.json
{ "title": "Email signature generator actor input schema", "description": "Enter your details for the Apify email signature. Only enter the values that you want to have in your signature.", "type": "object", "schemaVersion": 1, "properties": { "fullName": { "title": "Full Name", "type": "string", "description": "The full name displayed in the signature.", "editor": "textfield" }, "position": { "title": "Position", "type": "string", "description": "Your position in Apify.", "editor": "textfield" }, "phoneNumber": { "title": "Phone Number", "type": "string", "description": "Your phone number.", "editor": "textfield" }, "twitterUrl": { "title": "Twitter URL", "type": "string", "description": "The URL of your Twitter.", "editor": "textfield" }, "linkedInUrl": { "title": "LinkedIn URL", "type": "string", "description": "The URL of your LinkedIn.", "editor": "textfield" }, "githubUrl": { "title": "GitHub URL", "type": "string", "description": "The URL of your GitHub.", "editor": "textfield" }, "hubspotUrl": { "title": "Hubspot URL", "type": "string", "description": "The URL for Hubspot meetings.", "editor": "textfield" }, "otherUrls": { "title": "Other URLs", "type": "array", "description": "Other URLs. The first value is the label (e.g. \"Facebook\"), the second one is the URL (e.g. \"https://facebook.com\")", "editor": "keyValue", "uniqueItems": false, "placeholderKey": "Displayed label (e.g. \"Facebook\")", "placeholderValue": "URL (e.g. \"https://facebook.com\")" }, "apifyUrl": { "title": "Apify Profile URL", "type": "string", "description": "The URL of your Apify profile.", "editor": "textfield" }, "apifyUrlLabel": { "title": "Apify Profile URL Label", "type": "string", "description": "Optional label for your Apify profile URL. The default is \"Apify Profile\"", "editor": "textfield" }, "shouldDisplayHiring": { "title": "Should Display Hiring Information", "type": "boolean", "description": "Determines whether the hiring link gets displayed.", "editor": "checkbox" }, "shouldDisplayG2": { "title": "Should Display G2 banner", "type": "boolean", "description": "Determines whether the G2 banner gets displayed.", "editor": "checkbox" }, "type": { "title": "Signature type", "type": "string", "description": "The signature type.", "default": "Gmail", "editor": "select", "enum": ["Gmail", "Outlook"] } }, "required": ["fullName", "position", "shouldDisplayHiring", "type"]}
apify.json
{ "name": "email-signature-generator", "version": "0.0", "buildTag": "latest", "env": null, "template": "project_empty"}
package.json
{ "name": "email-signature-generator", "version": "0.0.1", "description": "This actor generates email signatures for Apify.", "dependencies": { "@types/node": "^14.17.4", "apify": "^1.0.1", "typescript": "^4.3.5" }, "devDependencies": { "@apify/eslint-config": "^0.1.3", "eslint": "^7.0.0" }, "scripts": { "start": "npm run build && node build/main.js", "lint": "./node_modules/.bin/eslint ./src --ext .js,.jsx", "lint:fix": "./node_modules/.bin/eslint ./src --ext .js,.jsx --fix", "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1", "build": "tsc -p tsconfig.json" }, "main": "build/main.js", "author": "Jiri Moravcik", "license": "ISC"}
test.html
<html><body> <div style="font-family: Verdana, sans-serif; font-size: 12px; font-weight: 400; color: #8d92af;"> <div style="font-weight: 600; line-height: 18px; color: #272c3d;">Jiri Moravcik</div> <div style="line-height: 18px;">Platform Engineer</div> <div style="display: flex; align-items: center;"> <a href="https://apify.com/"> <img src="https://apify.com/ext/apify-logo-120px.png" alt="Apify" style="margin-top: 12px; width:115px; margin-bottom: 12px;"> </a> </div> <div style="line-height: 18px;"><a href="https://linkedin.com/krystofjezek" style="color: #4990ff; text-decoration: none;">LinkedIn</a> | <a href="https://github.com/krystofjezek" style="color: #4990ff; text-decoration: none;">Github</a> | <a href="https://meetings.hubspot.com/shash-tandon" style="color: #4990ff; text-decoration: none;">Book a meeting</a> </div> <div style="line-height: 18px; margin-top: 12px;"><a href="https://apify.com" style="color: #4990ff; text-decoration: none; font-weight: 600;">Apify.com</a> </div></body></html>
tsconfig.json
{ "compilerOptions": { "target": "es2019", "module": "commonjs", "moduleResolution": "node", "strict": true, "noImplicitAny": false, "strictNullChecks": false, "lib": [ "DOM", "DOM.Iterable", "ES2015", "ES2016", "ES2018", "ES2019.Object", "ES2018.AsyncIterable", "ES2020.String", "ES2019.Array" ], "rootDir": "src/", "outDir": "build/" }, "include": [ "src/" ]}