Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/beehiiv/credentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type BeehiivCredentials = {
BEEHIIV_API_KEY?: string;
BEEHIIV_PUBLICATION_ID?: string;
};
18 changes: 18 additions & 0 deletions plugins/beehiiv/icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export function BeehiivIcon({ className }: { className?: string }) {
return (
<svg
aria-label="Beehiiv logo"
className={className}
fill="currentColor"
viewBox="0 0 117 111"
xmlns="http://www.w3.org/2000/svg"
>
<title>Beehiiv</title>
<path d="M101.7 51.8H15.3C13.1 51.8 11.3 50 11.3 47.8V41.7C11.3 34.8 16.9 29.2 23.8 29.2H93.1C100 29.2 105.6 34.8 105.6 41.7V47.8C105.7 50 103.9 51.8 101.7 51.8Z" fill="currentColor"/>
<path d="M83.5 22.6H33.5C31.3 22.6 29.4 20.8 29.4 18.5C29.4 8.3 37.7 0 47.9 0H69.1C79.3 0 87.6 8.3 87.6 18.5C87.6 20.8 85.8 22.6 83.5 22.6Z" fill="currentColor"/>
<path d="M105.7 58.4H11.3C5.1 58.4 0 63.5 0 69.7C0 75.9 5.1 81 11.3 81H44.8C46 74.6 51.6 69.7 58.4 69.7C65.2 69.7 70.9 74.6 72.1 81H105.6C111.8 81 116.9 75.9 116.9 69.7C116.9 63.5 111.9 58.4 105.7 58.4Z" fill="currentColor"/>
<path d="M101.6 87.6H72.3V110.2H94.3C100.5 110.2 105.6 105.1 105.6 98.9V91.7C105.7 89.5 103.9 87.6 101.6 87.6Z" fill="currentColor"/>
<path d="M15.3 87.6C13.1 87.6 11.2 89.4 11.2 91.7V98.9C11.2 105.1 16.3 110.2 22.5 110.2H44.5V87.6C44.6 87.6 15.3 87.6 15.3 87.6Z" fill="currentColor"/>
</svg>
);
}
307 changes: 307 additions & 0 deletions plugins/beehiiv/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
import type { IntegrationPlugin } from "../registry";
import { registerIntegration } from "../registry";
import { BeehiivIcon } from "./icon";

const beehiivPlugin: IntegrationPlugin = {
type: "beehiiv",
label: "Beehiiv",
description: "Newsletter platform for creators and publishers",

icon: BeehiivIcon,

formFields: [
{
id: "apiKey",
label: "API Key",
type: "password",
placeholder: "...",
configKey: "apiKey",
envVar: "BEEHIIV_API_KEY",
helpText: "Get your API key from ",
helpLink: {
text: "Beehiiv Dashboard",
url: "https://app.beehiiv.com/settings/workspace/api",
},
},
{
id: "publicationId",
label: "Publication ID",
type: "text",
placeholder: "pub_00000000-0000-0000-0000-000000000000",
configKey: "publicationId",
envVar: "BEEHIIV_PUBLICATION_ID",
helpText: "Get your publication ID from ",
helpLink: {
text: "Beehiiv Dashboard",
url: "https://app.beehiiv.com/settings/workspace/api",
},
},
],

testConfig: {
getTestFunction: async () => {
const { testBeehiiv } = await import("./test");
return testBeehiiv;
},
},

actions: [
{
slug: "create-subscription",
label: "Create Subscription",
description: "Create a new subscription for a publication",
category: "Beehiiv",
stepFunction: "createSubscriptionStep",
stepImportPath: "create-subscription",
outputFields: [
{ field: "id", description: "Subscription ID" },
{ field: "email", description: "Subscriber email" },
{ field: "status", description: "Subscription status" },
],
configFields: [
{
key: "email",
label: "Email",
type: "template-input",
placeholder: "subscriber@example.com or {{NodeName.email}}",
example: "subscriber@example.com",
required: true,
},
{
key: "reactivateExisting",
label: "Reactivate Existing",
type: "select",
options: [
{ value: "false", label: "No" },
{ value: "true", label: "Yes" },
],
defaultValue: "false",
},
{
key: "sendWelcomeEmail",
label: "Send Welcome Email",
type: "select",
options: [
{ value: "false", label: "No" },
{ value: "true", label: "Yes" },
],
defaultValue: "false",
},
{
key: "doubleOptOverride",
label: "Double Opt-In",
type: "select",
options: [
{ value: "not_set", label: "Use Publication Default" },
{ value: "on", label: "On" },
{ value: "off", label: "Off" },
],
defaultValue: "not_set",
},
{
key: "tier",
label: "Subscription Tier",
type: "select",
options: [
{ value: "free", label: "Free" },
{ value: "premium", label: "Premium" },
],
},
{
type: "group",
label: "Attribution",
fields: [
{
key: "utmSource",
label: "UTM Source",
type: "template-input",
placeholder: "WayneEnterprise",
example: "WayneEnterprise",
},
{
key: "utmMedium",
label: "UTM Medium",
type: "template-input",
placeholder: "organic",
example: "organic",
},
{
key: "utmCampaign",
label: "UTM Campaign",
type: "template-input",
placeholder: "fall_2022_promotion",
example: "fall_2022_promotion",
},
{
key: "referringSite",
label: "Referring Site",
type: "template-input",
placeholder: "www.example.com/blog",
example: "www.wayneenterprise.com/blog",
},
],
},
],
},
{
slug: "get-subscription",
label: "Get Subscription",
description: "Get subscription details by email",
category: "Beehiiv",
stepFunction: "getSubscriptionStep",
stepImportPath: "get-subscription",
outputFields: [
{ field: "id", description: "Subscription ID" },
{ field: "email", description: "Subscriber email" },
{ field: "status", description: "Subscription status" },
{ field: "created", description: "Creation timestamp" },
{ field: "subscriptionTier", description: "Subscription tier" },
],
configFields: [
{
key: "email",
label: "Email",
type: "template-input",
placeholder: "subscriber@example.com or {{NodeName.email}}",
example: "subscriber@example.com",
required: true,
},
{
key: "expand",
label: "Include Additional Data",
type: "select",
options: [
{ value: "none", label: "None" },
{ value: "stats", label: "Stats" },
{ value: "custom_fields", label: "Custom Fields" },
{ value: "referrals", label: "Referrals" },
{ value: "tags", label: "Tags" },
{ value: "subscription_premium_tiers", label: "Premium Tiers" },
],
defaultValue: "none",
},
],
},
{
slug: "update-subscription",
label: "Update Subscription",
description: "Update subscription details by email",
category: "Beehiiv",
stepFunction: "updateSubscriptionStep",
stepImportPath: "update-subscription",
outputFields: [
{ field: "id", description: "Subscription ID" },
{ field: "email", description: "Subscriber email" },
{ field: "status", description: "Subscription status" },
],
configFields: [
{
key: "email",
label: "Email",
type: "template-input",
placeholder: "subscriber@example.com or {{NodeName.email}}",
example: "subscriber@example.com",
required: true,
},
{
key: "tier",
label: "Subscription Tier",
type: "select",
options: [
{ value: "none", label: "No Change" },
{ value: "free", label: "Free" },
{ value: "premium", label: "Premium" },
],
defaultValue: "none",
},
{
key: "unsubscribe",
label: "Unsubscribe",
type: "select",
options: [
{ value: "false", label: "No" },
{ value: "true", label: "Yes" },
],
defaultValue: "false",
},
],
},
{
slug: "add-subscription-tag",
label: "Add Subscription Tag",
description: "Add tags to a subscription",
category: "Beehiiv",
stepFunction: "addSubscriptionTagStep",
stepImportPath: "add-subscription-tag",
outputFields: [
{ field: "id", description: "Subscription ID" },
{ field: "email", description: "Subscriber email" },
{ field: "tags", description: "Subscription tags" },
],
configFields: [
{
key: "subscriptionId",
label: "Subscription ID",
type: "template-input",
placeholder: "{{GetSubscription.id}}",
example: "sub_00000000-0000-0000-0000-000000000000",
required: true,
},
{
key: "tags",
label: "Tag(s)",
type: "template-input",
placeholder: "Premium, VIP",
example: "Premium, Basic",
required: true,
},
],
},
{
slug: "add-to-automation",
label: "Add to Automation",
description: "Add an existing subscription to an automation flow",
category: "Beehiiv",
stepFunction: "addToAutomationStep",
stepImportPath: "add-to-automation",
outputFields: [
{ field: "id", description: "Journey ID" },
{ field: "automationId", description: "Automation ID" },
{ field: "status", description: "Journey status" },
],
configFields: [
{
key: "automationId",
label: "Automation ID",
type: "template-input",
placeholder: "aut_00000000-0000-0000-0000-000000000000",
example: "aut_00000000-0000-0000-0000-000000000000",
required: true,
},
{
key: "subscriptionId",
label: "Subscription ID",
type: "template-input",
placeholder: "{{GetSubscription.id}}",
example: "sub_00000000-0000-0000-0000-000000000000",
required: true,
},
{
key: "doubleOptOverride",
label: "Double Opt-In",
type: "select",
options: [
{ value: "not_set", label: "Use Publication Default" },
{ value: "on", label: "On" },
{ value: "off", label: "Off" },
],
defaultValue: "not_set",
},
],
},
],
};

registerIntegration(beehiivPlugin);

export default beehiivPlugin;
Loading