n8n-nodes-wuzapi
Version:
n8n community nodes for Wuzapi - WhatsApp Multi-Device REST API
114 lines • 3.35 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BUTTON_STYLE_SECONDARY = exports.BUTTON_STYLE_PRIMARY = exports.ACTION_RECORDED_PAGE = void 0;
exports.createWhatsAppTemplateMessage = createWhatsAppTemplateMessage;
exports.createWhatsAppButtonMessage = createWhatsAppButtonMessage;
exports.ACTION_RECORDED_PAGE = `
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Action Recorded</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
background-color: #f5f5f5;
}
.container {
text-align: center;
padding: 2rem;
background: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
max-width: 400px;
}
.checkmark {
width: 56px;
height: 56px;
border-radius: 50%;
background: #22c55e;
display: inline-flex;
align-items: center;
justify-content: center;
margin-bottom: 1rem;
}
.checkmark svg {
width: 32px;
height: 32px;
stroke: white;
stroke-width: 3;
}
h1 {
color: #333;
font-size: 1.5rem;
margin: 0 0 0.5rem 0;
}
p {
color: #666;
margin: 0;
}
</style>
</head>
<body>
<div class="container">
<div class="checkmark">
<svg viewBox="0 0 24 24" fill="none">
<path d="M20 6L9 17L4 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<h1>Action Recorded</h1>
<p>Your response has been received. You can close this window.</p>
</div>
</body>
</html>
`;
exports.BUTTON_STYLE_PRIMARY = `
display: inline-block;
padding: 12px 24px;
margin: 4px;
background-color: #ff6d5a;
color: white;
text-decoration: none;
border-radius: 4px;
font-weight: 500;
font-size: 14px;
`;
exports.BUTTON_STYLE_SECONDARY = `
display: inline-block;
padding: 12px 24px;
margin: 4px;
background-color: #e1e4e8;
color: #24292e;
text-decoration: none;
border-radius: 4px;
font-weight: 500;
font-size: 14px;
`;
function createWhatsAppTemplateMessage(message, buttons, instanceId) {
const footer = instanceId
? 'This message was sent automatically with n8n'
: undefined;
const templateButtons = buttons.map(btn => ({
DisplayText: btn.label,
Type: 'quickreply',
}));
return {
content: message,
footer,
buttons: templateButtons,
};
}
function createWhatsAppButtonMessage(message, buttons) {
// For simple button messages, we'll use the body text with button indicators
const buttonText = buttons.map(btn => `[${btn.label}]`).join(' ');
return {
body: `${message}\n\n${buttonText}`,
};
}
//# sourceMappingURL=message-templates.js.map