Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(sendinblue): add 31 agent-facing atomics (#15599)

Kishan Parmarc9e925be75a4
diff --git a/bun.lock b/bun.lock
index 2a003be168e..0ac5b3781fc 100644
--- a/bun.lock
+++ b/bun.lock
@@ -8085,7 +8085,7 @@
},
"packages/pieces/community/sendinblue": {
"name": "@activepieces/piece-sendinblue",
- "version": "0.4.0",
+ "version": "0.4.1",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/sendinblue/package.json b/packages/pieces/community/sendinblue/package.json
index 0ac1187d44e..86c13cc77ac 100644
--- a/packages/pieces/community/sendinblue/package.json
+++ b/packages/pieces/community/sendinblue/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-sendinblue",
- "version": "0.4.0",
+ "version": "0.4.1",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/sendinblue/src/index.ts b/packages/pieces/community/sendinblue/src/index.ts
index 4e1b7fa393a..636f443bc3d 100644
--- a/packages/pieces/community/sendinblue/src/index.ts
+++ b/packages/pieces/community/sendinblue/src/index.ts
@@ -1,12 +1,43 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { createPiece } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/pieces-framework';
+import { createCompany } from './lib/actions/create-company';
+import { createContactList } from './lib/actions/create-contact-list';
+import { createEmailCampaign } from './lib/actions/create-email-campaign';
import { createEvent } from './lib/actions/create-event';
import { createOrUpdateContact } from './lib/actions/create-or-update-contact';
+import { createOrUpdateEmailTemplate } from './lib/actions/create-or-update-email-template';
+import { createSmsCampaign } from './lib/actions/create-sms-campaign';
+import { deleteCompany } from './lib/actions/delete-company';
+import { deleteContact } from './lib/actions/delete-contact';
+import { deleteEmailTemplate } from './lib/actions/delete-email-template';
+import { deleteSmsCampaign } from './lib/actions/delete-sms-campaign';
import { findContact } from './lib/actions/find-contact';
+import { getAccountInfo } from './lib/actions/get-account-info';
+import { getCompany } from './lib/actions/get-company';
+import { getContactCampaignStats } from './lib/actions/get-contact-campaign-stats';
+import { getContactList } from './lib/actions/get-contact-list';
+import { getEmailCampaign } from './lib/actions/get-email-campaign';
+import { getEmailTemplate } from './lib/actions/get-email-template';
+import { getSmsCampaign } from './lib/actions/get-sms-campaign';
+import { importContacts } from './lib/actions/import-contacts';
+import { listCompanies } from './lib/actions/list-companies';
+import { listContactAttributes } from './lib/actions/list-contact-attributes';
+import { listContactLists } from './lib/actions/list-contact-lists';
+import { listContacts } from './lib/actions/list-contacts';
+import { listCrmNotes } from './lib/actions/list-crm-notes';
+import { listEmailCampaigns } from './lib/actions/list-email-campaigns';
+import { listEmailTemplates } from './lib/actions/list-email-templates';
+import { listSenderDomains } from './lib/actions/list-sender-domains';
+import { listSenders } from './lib/actions/list-senders';
+import { listSmsCampaigns } from './lib/actions/list-sms-campaigns';
+import { listTransactionalEmailEvents } from './lib/actions/list-transactional-email-events';
+import { sendEmailCampaignNow } from './lib/actions/send-email-campaign-now';
import { sendTransactionalEmail } from './lib/actions/send-transactional-email';
import { sendTransactionalSms } from './lib/actions/send-transactional-sms';
import { unsubscribeContact } from './lib/actions/unsubscribe-contact';
+import { updateContact } from './lib/actions/update-contact';
+import { updateEmailCampaign } from './lib/actions/update-email-campaign';
import { sendinblueAuth } from './lib/auth';
import { BREVO_API_URL } from './lib/common';
import { contactAddedToList } from './lib/triggers/contact-added-to-list';
@@ -22,7 +53,7 @@ export const sendinblue = createPiece({
displayName: 'Brevo',
description:
'Formerly Sendinblue, is a SaaS solution for relationship marketing',
- minimumSupportedRelease: '0.30.0',
+ minimumSupportedRelease: '0.87.0',
logoUrl: 'https://cdn.activepieces.com/pieces/brevo.png',
authors: ["kanarelo","BLaidzX","Salem-Alaa","kishanprmr","MoShizzle","khaledmashaly","abuaboud"],
categories: [PieceCategory.MARKETING],
@@ -34,6 +65,37 @@ export const sendinblue = createPiece({
sendTransactionalEmail,
sendTransactionalSms,
createEvent,
+ listContacts,
+ updateContact,
+ deleteContact,
+ importContacts,
+ listContactAttributes,
+ getContactCampaignStats,
+ createContactList,
+ listContactLists,
+ getContactList,
+ createCompany,
+ getCompany,
+ listCompanies,
+ deleteCompany,
+ listCrmNotes,
+ listSenders,
+ listSenderDomains,
+ createOrUpdateEmailTemplate,
+ getEmailTemplate,
+ listEmailTemplates,
+ deleteEmailTemplate,
+ createEmailCampaign,
+ updateEmailCampaign,
+ getEmailCampaign,
+ listEmailCampaigns,
+ sendEmailCampaignNow,
+ createSmsCampaign,
+ getSmsCampaign,
+ listSmsCampaigns,
+ deleteSmsCampaign,
+ listTransactionalEmailEvents,
+ getAccountInfo,
createCustomApiCallAction({
baseUrl: () => BREVO_API_URL,
auth: sendinblueAuth,
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/create-company.ts b/packages/pieces/community/sendinblue/src/lib/actions/create-company.ts
new file mode 100644
index 00000000000..47b3ea8bb1c
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/create-company.ts
@@ -0,0 +1,76 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { createCompanyActionOutputSchema } from '../output-schemas';
+
+export const createCompany = createAction({
+ auth: sendinblueAuth,
+ name: 'create_company',
+ outputSchema: createCompanyActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Create Company',
+ description: 'Create a new company record in Brevo CRM.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a new Brevo CRM company with a name and optional custom attributes, and can link it to existing contacts and deals in the same call. Each call creates a new company record, so retries duplicate it — look it up first with List Companies if you are unsure whether it already exists.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Name of the company.',
+ required: true,
+ }),
+ attributes: Property.Object({
+ displayName: 'Attributes',
+ description:
+ "Custom company attributes such as domain, industry, phone_number, address, city, country. Attribute keys depend on your Brevo account's CRM configuration.",
+ required: false,
+ }),
+ country_code: Property.Number({
+ displayName: 'Phone Country Code',
+ description:
+ 'Country code for any phone number in attributes, e.g. 1 for USA, 44 for UK. Only needed when a phone attribute is set.',
+ required: false,
+ }),
+ linked_contacts_ids: Property.Array({
+ displayName: 'Linked Contact IDs',
+ description: 'Existing Brevo contact IDs to link to this company.',
+ required: false,
+ }),
+ linked_deals_ids: Property.Array({
+ displayName: 'Linked Deal IDs',
+ description: 'Existing Brevo deal IDs to link to this company.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { name, attributes, country_code, linked_contacts_ids, linked_deals_ids } =
+ context.propsValue;
+
+ const linkedContactsIds = (linked_contacts_ids ?? [])
+ .map((contactId) => Number(contactId))
+ .filter((contactId) => Number.isFinite(contactId));
+
+ const linkedDealsIds = (Array.isArray(linked_deals_ids) ? linked_deals_ids : [])
+ .map((dealId) => String(dealId).trim())
+ .filter((dealId) => dealId.length > 0);
+
+ const body = {
+ name,
+ attributes: brevoCommon.isEmptyObject(attributes) ? undefined : attributes,
+ countryCode: country_code,
+ linkedContactsIds: linkedContactsIds.length > 0 ? linkedContactsIds : undefined,
+ linkedDealsIds: linkedDealsIds.length > 0 ? linkedDealsIds : undefined,
+ };
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ resourceUri: '/companies',
+ body,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/create-contact-list.ts b/packages/pieces/community/sendinblue/src/lib/actions/create-contact-list.ts
new file mode 100644
index 00000000000..72f2b61655b
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/create-contact-list.ts
@@ -0,0 +1,47 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { createContactListActionOutputSchema } from '../output-schemas';
+
+export const createContactList = createAction({
+ auth: sendinblueAuth,
+ name: 'create_contact_list',
+ outputSchema: createContactListActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Create Contact List',
+ description: 'Create a new contact list in Brevo.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a new Brevo contact list inside a folder and returns its numeric id. Use List Contact Lists first to find a folder id if you do not already know one. Not idempotent — calling this again with the same name creates another list, Brevo does not dedupe by name.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ folder_id: Property.Number({
+ displayName: 'Folder ID',
+ description:
+ "ID of the folder to create this list in. Use List Contact Lists first if you don't know a folder id; Brevo's default folder for a new account is usually id 1, but this varies.",
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { name, folder_id } = context.propsValue;
+
+ const list = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ resourceUri: '/contacts/lists',
+ body: {
+ name,
+ folderId: folder_id,
+ },
+ });
+
+ return list;
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/create-email-campaign.ts b/packages/pieces/community/sendinblue/src/lib/actions/create-email-campaign.ts
new file mode 100644
index 00000000000..6b0b62dbb03
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/create-email-campaign.ts
@@ -0,0 +1,210 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { brevoProps } from '../common/props';
+import { createEmailCampaignActionOutputSchema } from '../output-schemas';
+
+export const createEmailCampaign = createAction({
+ auth: sendinblueAuth,
+ name: 'create_email_campaign',
+ outputSchema: createEmailCampaignActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Create Email Campaign',
+ description: 'Create a new email marketing campaign in Brevo.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a new Brevo email marketing campaign, either by copying an existing transactional template or by supplying a subject with HTML content, and optionally assigns recipient lists and a send schedule. Use for bulk/marketing sends; use Send Transactional Email for per-recipient transactional mail instead. Provide either a template, or a subject with HTML content/HTML URL — Brevo rejects the request otherwise. Omitting Scheduled At creates an unsent draft. Not idempotent — each call creates a new campaign.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Internal campaign name shown only in the Brevo dashboard, not to recipients.',
+ required: true,
+ }),
+ sender_email: brevoProps.senderEmail,
+ sender_name: Property.ShortText({
+ displayName: 'Sender Name',
+ description: 'Overrides the display name of the selected sender.',
+ required: false,
+ }),
+ sender_id: Property.Number({
+ displayName: 'Sender ID',
+ description:
+ 'Alternative to Sender Email/Sender Name: an existing Brevo sender id. Provide one or the other, not both.',
+ required: false,
+ }),
+ subject: Property.ShortText({
+ displayName: 'Subject',
+ description: 'Subject line shown to recipients. Required unless Template is selected.',
+ required: false,
+ }),
+ template_id: Property.Number({
+ displayName: 'Template ID',
+ description:
+ 'ID of an existing Brevo transactional template whose content is copied into this campaign. Mutually exclusive with HTML Content and HTML URL.',
+ required: false,
+ }),
+ html_content: Property.LongText({
+ displayName: 'HTML Content',
+ description: 'Required unless a template is selected. Mutually exclusive with HTML URL.',
+ required: false,
+ }),
+ html_url: Property.ShortText({
+ displayName: 'HTML URL',
+ description: 'URL Brevo fetches the HTML content from. Mutually exclusive with HTML Content.',
+ required: false,
+ }),
+ list_ids: brevoProps.listIds({
+ displayName: 'Recipient Lists',
+ description: 'Contact lists to send this campaign to.',
+ }),
+ exclusion_list_ids: brevoProps.listIds({
+ displayName: 'Exclude Lists',
+ description:
+ 'Contact lists to exclude from this campaign, even if a contact also belongs to a recipient list.',
+ }),
+ scheduled_at: Property.DateTime({
+ displayName: 'Scheduled At',
+ description: 'Schedule the send; omit to create an unsent draft.',
+ required: false,
+ }),
+ reply_to_email: Property.ShortText({
+ displayName: 'Reply To',
+ description: 'Email address replies are sent to, if different from the sender.',
+ required: false,
+ }),
+ preview_text: Property.ShortText({
+ displayName: 'Preview Text',
+ description: 'Preheader text shown next to the subject line in most inboxes.',
+ required: false,
+ }),
+ to_field: Property.ShortText({
+ displayName: 'To Field',
+ description:
+ "Overrides how the recipient's name/email appears in the To field, e.g. \"{{contact.FIRSTNAME}}\".",
+ required: false,
+ }),
+ params: Property.Object({
+ displayName: 'Template Parameters',
+ description: 'Personalization variables available when Template is selected.',
+ required: false,
+ }),
+ footer: Property.LongText({
+ displayName: 'Footer',
+ description: 'HTML footer appended to the campaign, typically the unsubscribe link and address.',
+ required: false,
+ }),
+ header: Property.LongText({
+ displayName: 'Header',
+ description: 'HTML header prepended to the campaign.',
+ required: false,
+ }),
+ utm_campaign: Property.ShortText({
+ displayName: 'UTM Campaign',
+ description: 'Value used for the utm_campaign tracking parameter on links in this email.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const {
+ name,
+ sender_email,
+ sender_name,
+ sender_id,
+ subject,
+ template_id,
+ html_content,
+ html_url,
+ list_ids,
+ exclusion_list_ids,
+ scheduled_at,
+ reply_to_email,
+ preview_text,
+ to_field,
+ params,
+ footer,
+ header,
+ utm_campaign,
+ } = context.propsValue;
+
+ if (!isNil(sender_id) && !isNil(sender_email)) {
+ throw new Error('Provide Sender ID or Sender Email, not both.');
+ }
+ if (isNil(sender_id) && isNil(sender_email)) {
+ throw new Error('Provide a Sender ID or Sender Email.');
+ }
+
+ const contentSourceCount = [!isNil(template_id), !isNil(html_content), !isNil(html_url)].filter(
+ Boolean,
+ ).length;
+ if (contentSourceCount === 0) {
+ throw new Error('Provide a Template ID, HTML Content, or HTML URL.');
+ }
+ if (contentSourceCount > 1) {
+ throw new Error('Provide only one of Template ID, HTML Content, or HTML URL.');
+ }
+ if (isNil(template_id) && isNil(subject)) {
+ throw new Error('Subject is required unless Template ID is provided.');
+ }
+
+ const listIds = (list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const exclusionListIds = (exclusion_list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const body = {
+ name,
+ sender: buildSender({ sender_id, sender_email, sender_name }),
+ subject: subject ?? undefined,
+ templateId: template_id ?? undefined,
+ htmlContent: html_content ?? undefined,
+ htmlUrl: html_url ?? undefined,
+ recipients:
+ listIds.length > 0 || exclusionListIds.length > 0
+ ? {
+ listIds: listIds.length > 0 ? listIds : undefined,
+ exclusionListIds: exclusionListIds.length > 0 ? exclusionListIds : undefined,
+ }
+ : undefined,
+ scheduledAt: scheduled_at ?? undefined,
+ replyTo: reply_to_email ?? undefined,
+ previewText: preview_text ?? undefined,
+ toField: to_field ?? undefined,
+ params: brevoCommon.isEmptyObject(params) ? undefined : params,
+ footer: footer ?? undefined,
+ header: header ?? undefined,
+ utmCampaign: utm_campaign ?? undefined,
+ };
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ resourceUri: '/emailCampaigns',
+ body,
+ });
+ },
+});
+
+function buildSender({
+ sender_id,
+ sender_email,
+ sender_name,
+}: {
+ sender_id: number | undefined;
+ sender_email: string | undefined;
+ sender_name: string | undefined;
+}): { id: number } | { email: string; name?: string } | undefined {
+ if (!isNil(sender_id)) {
+ return { id: sender_id };
+ }
+ if (!isNil(sender_email)) {
+ return { email: sender_email, name: sender_name ?? undefined };
+ }
+ return undefined;
+}
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/create-or-update-email-template.ts b/packages/pieces/community/sendinblue/src/lib/actions/create-or-update-email-template.ts
new file mode 100644
index 00000000000..0fbe4153995
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/create-or-update-email-template.ts
@@ -0,0 +1,149 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { brevoProps } from '../common/props';
+import { createOrUpdateEmailTemplateActionOutputSchema } from '../output-schemas';
+
+export const createOrUpdateEmailTemplate = createAction({
+ auth: sendinblueAuth,
+ name: 'create_or_update_email_template',
+ outputSchema: createOrUpdateEmailTemplateActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Create or Update Email Template',
+ description: 'Create a new Brevo email template, or update an existing one by id.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Provide template_id for a safe, idempotent update of an existing template; omitting it creates a new template on every call. Creating requires template_name, subject, sender_email and either html_content or html_url. Updating only changes the fields supplied — omitted fields keep their current value.',
+ idempotent: false,
+ },
+ props: {
+ template_id: Property.Number({
+ displayName: 'Template ID',
+ description: 'Provide to update an existing template; omit to create a new one.',
+ required: false,
+ }),
+ template_name: Property.ShortText({
+ displayName: 'Template Name',
+ description: 'Required when creating a new template.',
+ required: false,
+ }),
+ subject: Property.ShortText({
+ displayName: 'Subject',
+ description: 'Required when creating a new template.',
+ required: false,
+ }),
+ sender_email: brevoProps.senderEmail,
+ sender_name: Property.ShortText({
+ displayName: 'Sender Name',
+ required: false,
+ }),
+ html_content: Property.LongText({
+ displayName: 'HTML Content',
+ description:
+ 'Required when creating a new template unless HTML URL is given. Must be at least 10 characters.',
+ required: false,
+ }),
+ html_url: Property.ShortText({
+ displayName: 'HTML URL',
+ description: 'URL Brevo fetches the HTML content from. Mutually exclusive with HTML Content.',
+ required: false,
+ }),
+ reply_to_email: Property.ShortText({
+ displayName: 'Reply To',
+ required: false,
+ }),
+ to_field: Property.ShortText({
+ displayName: 'To Field',
+ description: 'Personalization used for the display name in the To field, for example {{contact.FIRSTNAME}}.',
+ required: false,
+ }),
+ is_active: Property.Checkbox({
+ displayName: 'Active',
+ description: "Leave untouched to keep the template's current active state.",
+ required: false,
+ }),
+ tag: Property.ShortText({
+ displayName: 'Tag',
+ required: false,
+ }),
+ attachment_url: Property.ShortText({
+ displayName: 'Attachment URL',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const {
+ template_id,
+ template_name,
+ subject,
+ sender_email,
+ sender_name,
+ html_content,
+ html_url,
+ reply_to_email,
+ to_field,
+ is_active,
+ tag,
+ attachment_url,
+ } = context.propsValue;
+
+ const isUpdate = !isNil(template_id);
+
+ if (!isNil(html_content) && !isNil(html_url)) {
+ throw new Error('Provide HTML Content or HTML URL, not both.');
+ }
+
+ if (!isUpdate) {
+ if (isNil(template_name)) {
+ throw new Error('Template Name is required when creating a new template.');
+ }
+ if (isNil(subject)) {
+ throw new Error('Subject is required when creating a new template.');
+ }
+ if (isNil(sender_email)) {
+ throw new Error('Sender is required when creating a new template.');
+ }
+ if (isNil(html_content) && isNil(html_url)) {
+ throw new Error('Provide HTML Content or HTML URL when creating a new template.');
+ }
+ if (!isNil(html_content) && html_content.length < 10) {
+ throw new Error('HTML Content must be at least 10 characters.');
+ }
+ }
+
+ const body = {
+ templateName: template_name,
+ subject,
+ sender: isNil(sender_email)
+ ? undefined
+ : { email: sender_email, name: sender_name ?? undefined },
+ htmlContent: html_content,
+ htmlUrl: html_url,
+ replyTo: reply_to_email,
+ toField: to_field,
+ isActive: is_active,
+ tag,
+ attachmentUrl: attachment_url,
+ };
+
+ if (isUpdate) {
+ await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ resourceUri: `/smtp/templates/${template_id}`,
+ body,
+ });
+
+ return { success: true, id: template_id };
+ }
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ resourceUri: '/smtp/templates',
+ body,
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/create-sms-campaign.ts b/packages/pieces/community/sendinblue/src/lib/actions/create-sms-campaign.ts
new file mode 100644
index 00000000000..46f66d90820
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/create-sms-campaign.ts
@@ -0,0 +1,124 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { brevoProps } from '../common/props';
+import { createSmsCampaignActionOutputSchema } from '../output-schemas';
+
+export const createSmsCampaign = createAction({
+ auth: sendinblueAuth,
+ name: 'create_sms_campaign',
+ outputSchema: createSmsCampaignActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Create SMS Campaign',
+ description: 'Create a new SMS campaign in Brevo.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a Brevo SMS campaign targeting one or more contact lists, exclusion lists and/or segments. Omit scheduled_at to create an unsent draft that can be reviewed or scheduled later. Not idempotent — calling this again creates another campaign.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Internal campaign name.',
+ required: true,
+ }),
+ sender: Property.ShortText({
+ displayName: 'Sender',
+ description:
+ 'Name or number shown as the sender. Limited to 11 alphanumeric characters or 15 numeric characters.',
+ required: true,
+ }),
+ content: Property.LongText({
+ displayName: 'Content',
+ description:
+ 'Message body. Max 160 characters per SMS segment; longer content is split into multiple billed segments.',
+ required: true,
+ }),
+ list_ids: brevoProps.listIds({
+ displayName: 'Recipient Lists',
+ description: 'Contact lists to send this campaign to.',
+ }),
+ exclusion_list_ids: brevoProps.listIds({
+ displayName: 'Exclude Lists',
+ description: 'Contact lists to exclude from this campaign.',
+ }),
+ segment_ids: Property.Array({
+ displayName: 'Segment IDs',
+ description: 'Brevo segment IDs to target.',
+ required: false,
+ }),
+ scheduled_at: Property.DateTime({
+ displayName: 'Scheduled At',
+ description: 'Omit to create an unsent draft.',
+ required: false,
+ }),
+ unicode_enabled: Property.Checkbox({
+ displayName: 'Unicode Enabled',
+ required: false,
+ defaultValue: false,
+ }),
+ organisation_prefix: Property.ShortText({
+ displayName: 'Organisation Prefix',
+ description: 'Brand name prepended to the message content.',
+ required: false,
+ }),
+ unsubscribe_instruction: Property.ShortText({
+ displayName: 'Unsubscribe Instruction',
+ description: 'Must include the word STOP; recommended by US carriers.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const {
+ name,
+ sender,
+ content,
+ list_ids,
+ exclusion_list_ids,
+ segment_ids,
+ scheduled_at,
+ unicode_enabled,
+ organisation_prefix,
+ unsubscribe_instruction,
+ } = context.propsValue;
+
+ const listIds = (list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const exclusionListIds = (exclusion_list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const segmentIds = (Array.isArray(segment_ids) ? segment_ids : [])
+ .map((segmentId) => Number(segmentId))
+ .filter((segmentId) => Number.isFinite(segmentId));
+
+ const hasRecipients =
+ listIds.length > 0 || exclusionListIds.length > 0 || segmentIds.length > 0;
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ resourceUri: '/smsCampaigns',
+ body: {
+ name,
+ sender,
+ content,
+ recipients: hasRecipients
+ ? {
+ listIds: listIds.length > 0 ? listIds : undefined,
+ exclusionListIds: exclusionListIds.length > 0 ? exclusionListIds : undefined,
+ segmentIds: segmentIds.length > 0 ? segmentIds : undefined,
+ }
+ : undefined,
+ scheduledAt: scheduled_at,
+ unicodeEnabled: unicode_enabled,
+ organisationPrefix: organisation_prefix,
+ unsubscribeInstruction: unsubscribe_instruction,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/delete-company.ts b/packages/pieces/community/sendinblue/src/lib/actions/delete-company.ts
new file mode 100644
index 00000000000..9dd3bd7a763
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/delete-company.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+
+export const deleteCompany = createAction({
+ auth: sendinblueAuth,
+ name: 'delete_company',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Company',
+ description: 'Permanently delete a Brevo CRM company.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently removes a Brevo CRM company record by id. This cannot be undone, and contacts or deals linked to the company are not themselves deleted. Not idempotent — a retry after the first successful call 404s because the company no longer exists.',
+ idempotent: false,
+ },
+ props: {
+ company_id: Property.ShortText({
+ displayName: 'Company ID',
+ description: "The Brevo company id, e.g. '61a5cd07ca1347c82306ad06'.",
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { company_id } = context.propsValue;
+
+ await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ resourceUri: `/companies/${encodeURIComponent(company_id)}`,
+ });
+
+ return { success: true };
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/delete-contact.ts b/packages/pieces/community/sendinblue/src/lib/actions/delete-contact.ts
new file mode 100644
index 00000000000..324db54046d
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/delete-contact.ts
@@ -0,0 +1,53 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+
+export const deleteContact = createAction({
+ auth: sendinblueAuth,
+ name: 'delete_contact',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Contact',
+ description: 'Permanently delete a contact from Brevo.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a Brevo contact identified by email, phone number, contact id, external id, WhatsApp id or landline number. This removes the contact record entirely and cannot be undone; prefer unsubscribe_contact when the intent is only to stop sending, not to erase the record. Not idempotent — retrying after a successful delete returns a 404 for the now-missing contact.',
+ idempotent: false,
+ },
+ props: {
+ identifier: Property.ShortText({
+ displayName: 'Identifier',
+ description: 'The value to look the contact up by, for example an email address.',
+ required: true,
+ }),
+ identifier_type: Property.StaticDropdown({
+ displayName: 'Identifier Type',
+ description: 'How the identifier above should be interpreted.',
+ required: false,
+ defaultValue: 'email_id',
+ options: {
+ options: [
+ { label: 'Email', value: 'email_id' },
+ { label: 'Phone (SMS)', value: 'phone_id' },
+ { label: 'Contact ID', value: 'contact_id' },
+ { label: 'External ID', value: 'ext_id' },
+ { label: 'WhatsApp', value: 'whatsapp_id' },
+ { label: 'Landline Number', value: 'landline_number_id' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { identifier, identifier_type } = context.propsValue;
+
+ await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ resourceUri: `/contacts/${encodeURIComponent(identifier)}`,
+ query: { identifierType: identifier_type },
+ });
+
+ return { success: true };
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/delete-email-template.ts b/packages/pieces/community/sendinblue/src/lib/actions/delete-email-template.ts
new file mode 100644
index 00000000000..fca0654acf9
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/delete-email-template.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+
+export const deleteEmailTemplate = createAction({
+ auth: sendinblueAuth,
+ name: 'delete_email_template',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Email Template',
+ description: 'Delete an email template from your Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a Brevo email template by id. Brevo only allows deleting an inactive template — if this fails, deactivate the template first via Create or Update Email Template with is_active unchecked. Not idempotent — a retry after success errors because the template no longer exists.',
+ idempotent: false,
+ },
+ props: {
+ template_id: Property.Number({
+ displayName: 'Template ID',
+ description: 'The id of the template to delete.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { template_id } = context.propsValue;
+
+ await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ resourceUri: `/smtp/templates/${template_id}`,
+ });
+
+ return { success: true };
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/delete-sms-campaign.ts b/packages/pieces/community/sendinblue/src/lib/actions/delete-sms-campaign.ts
new file mode 100644
index 00000000000..c85cecaa0f1
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/delete-sms-campaign.ts
@@ -0,0 +1,35 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+
+export const deleteSmsCampaign = createAction({
+ auth: sendinblueAuth,
+ name: 'delete_sms_campaign',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete SMS Campaign',
+ description: 'Permanently delete a Brevo SMS campaign.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a Brevo SMS campaign by id, whether it is a draft or already sent. This cannot be undone. Not idempotent — a retry after the first successful call 404s because the campaign no longer exists.',
+ idempotent: false,
+ },
+ props: {
+ campaign_id: Property.Number({
+ displayName: 'Campaign ID',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { campaign_id } = context.propsValue;
+
+ await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.DELETE,
+ resourceUri: `/smsCampaigns/${campaign_id}`,
+ });
+
+ return { success: true };
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/get-account-info.ts b/packages/pieces/community/sendinblue/src/lib/actions/get-account-info.ts
new file mode 100644
index 00000000000..6375cb5c163
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/get-account-info.ts
@@ -0,0 +1,30 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { getAccountInfoActionOutputSchema } from '../output-schemas';
+
+export const getAccountInfo = createAction({
+ auth: sendinblueAuth,
+ name: 'get_account_info',
+ outputSchema: getAccountInfoActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Account Info',
+ description: 'Fetch the Brevo account holder information, plan and credits.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Retrieves the Brevo account holder details, address, plan/credits and transactional-email and marketing-automation configuration for the connected account. Use this to check remaining email or SMS credits, or to verify which Brevo account/plan a connection points to, before running a bulk send. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ const response = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/account',
+ });
+
+ return response;
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/get-company.ts b/packages/pieces/community/sendinblue/src/lib/actions/get-company.ts
new file mode 100644
index 00000000000..2978f098dc3
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/get-company.ts
@@ -0,0 +1,45 @@
+import { HttpError, HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { getCompanyActionOutputSchema } from '../output-schemas';
+
+export const getCompany = createAction({
+ auth: sendinblueAuth,
+ name: 'get_company',
+ outputSchema: getCompanyActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Company',
+ description: 'Fetch a Brevo CRM company by its id.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Looks up a single Brevo CRM company by its id and returns its attributes and linked contacts/deals. Returns found:false instead of failing when no company matches that id, so it is safe to branch on. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ company_id: Property.ShortText({
+ displayName: 'Company ID',
+ description: "The Brevo company id, e.g. '61a5cd07ca1347c82306ad06'.",
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { company_id } = context.propsValue;
+
+ try {
+ const company = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: `/companies/${encodeURIComponent(company_id)}`,
+ });
+
+ return { found: true, data: company };
+ } catch (error) {
+ if (error instanceof HttpError && error.response.status === 404) {
+ return { found: false, data: {} };
+ }
+ throw error;
+ }
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/get-contact-campaign-stats.ts b/packages/pieces/community/sendinblue/src/lib/actions/get-contact-campaign-stats.ts
new file mode 100644
index 00000000000..176388a45d0
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/get-contact-campaign-stats.ts
@@ -0,0 +1,54 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { getContactCampaignStatsActionOutputSchema } from '../output-schemas';
+
+export const getContactCampaignStats = createAction({
+ auth: sendinblueAuth,
+ name: 'get_contact_campaign_stats',
+ outputSchema: getContactCampaignStatsActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Contact Campaign Stats',
+ description: `Get a contact's engagement statistics (opens, clicks, deliveries, and more) across campaigns.`,
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ `Fetches a Brevo contact's campaign engagement statistics, such as opened, clicked, delivered, and unsubscribed events, optionally restricted to a date range. Start Date and End Date must both be supplied or both omitted, and Brevo caps the range at 90 days. Read-only and idempotent, though results can change over time as new engagement events occur.`,
+ idempotent: true,
+ },
+ props: {
+ identifier: Property.ShortText({
+ displayName: 'Identifier',
+ description: 'Email address or numeric contact id of the contact.',
+ required: true,
+ }),
+ start_date: Property.ShortText({
+ displayName: 'Start Date',
+ description: 'YYYY-MM-DD. Must be supplied together with End Date.',
+ required: false,
+ }),
+ end_date: Property.ShortText({
+ displayName: 'End Date',
+ description: 'YYYY-MM-DD. Must be supplied together with Start Date. Brevo caps the range at 90 days.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { identifier, start_date, end_date } = context.propsValue;
+
+ if (isNil(start_date) !== isNil(end_date)) {
+ throw new Error('Provide both Start Date and End Date, or neither.');
+ }
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: `/contacts/${encodeURIComponent(identifier)}/campaignStats`,
+ query: {
+ startDate: start_date,
+ endDate: end_date,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/get-contact-list.ts b/packages/pieces/community/sendinblue/src/lib/actions/get-contact-list.ts
new file mode 100644
index 00000000000..0e9e556120c
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/get-contact-list.ts
@@ -0,0 +1,60 @@
+import { HttpError, HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { getContactListActionOutputSchema } from '../output-schemas';
+
+export const getContactList = createAction({
+ auth: sendinblueAuth,
+ name: 'get_contact_list',
+ outputSchema: getContactListActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Contact List',
+ description: 'Get the details of a single Brevo contact list by id.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches a single Brevo contact list by its numeric id, including subscriber counts and folder id. Pass start_date and end_date together to also include the list campaign statistics for that window. Returns found:false instead of failing when the list id does not exist, so it is safe to branch on. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ list_id: Property.Number({
+ displayName: 'List ID',
+ required: true,
+ }),
+ start_date: Property.ShortText({
+ displayName: 'Start Date',
+ description:
+ 'ISO 8601 date (e.g. 2023-01-01). Must be given together with End Date for campaign statistics to appear in the response.',
+ required: false,
+ }),
+ end_date: Property.ShortText({
+ displayName: 'End Date',
+ description:
+ 'ISO 8601 date (e.g. 2023-01-31). Must be given together with Start Date for campaign statistics to appear in the response.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { list_id, start_date, end_date } = context.propsValue;
+
+ try {
+ const list = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: `/contacts/lists/${list_id}`,
+ query: {
+ startDate: start_date,
+ endDate: end_date,
+ },
+ });
+
+ return { found: true, data: list };
+ } catch (error) {
+ if (error instanceof HttpError && error.response.status === 404) {
+ return { found: false, data: {} };
+ }
+ throw error;
+ }
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/get-email-campaign.ts b/packages/pieces/community/sendinblue/src/lib/actions/get-email-campaign.ts
new file mode 100644
index 00000000000..1591fe76175
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/get-email-campaign.ts
@@ -0,0 +1,59 @@
+import { HttpError, HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { getEmailCampaignActionOutputSchema } from '../output-schemas';
+
+export const getEmailCampaign = createAction({
+ auth: sendinblueAuth,
+ name: 'get_email_campaign',
+ outputSchema: getEmailCampaignActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Email Campaign',
+ description: 'Fetch a Brevo email campaign by id, including its statistics.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches a single Brevo email campaign by its numeric id, including its recipients, content and send statistics. Pass Statistics to limit the returned report to one category (e.g. Global Stats) instead of the full report. Returns found:false instead of failing when the campaign id does not exist, so it is safe to branch on. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ campaign_id: Property.Number({
+ displayName: 'Campaign ID',
+ required: true,
+ }),
+ statistics: Property.StaticDropdown({
+ displayName: 'Statistics',
+ description: 'Limit the returned statistics to one category; omit for the full report.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Global Stats', value: 'globalStats' },
+ { label: 'Links Stats', value: 'linksStats' },
+ { label: 'Stats By Domain', value: 'statsByDomain' },
+ { label: 'Stats By Device', value: 'statsByDevice' },
+ { label: 'Stats By Browser', value: 'statsByBrowser' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { campaign_id, statistics } = context.propsValue;
+
+ try {
+ const campaign = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: `/emailCampaigns/${campaign_id}`,
+ query: { statistics },
+ });
+
+ return { found: true, data: campaign };
+ } catch (error) {
+ if (error instanceof HttpError && error.response.status === 404) {
+ return { found: false, data: {} };
+ }
+ throw error;
+ }
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/get-email-template.ts b/packages/pieces/community/sendinblue/src/lib/actions/get-email-template.ts
new file mode 100644
index 00000000000..5ec22201405
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/get-email-template.ts
@@ -0,0 +1,45 @@
+import { HttpError, HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { getEmailTemplateActionOutputSchema } from '../output-schemas';
+
+export const getEmailTemplate = createAction({
+ auth: sendinblueAuth,
+ name: 'get_email_template',
+ outputSchema: getEmailTemplateActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Email Template',
+ description: 'Fetch a single Brevo email template by id.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Looks up a single Brevo email template by its id and returns its full details including subject, sender and HTML content. Returns found:false instead of failing when no template matches, so it is safe to branch on. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ template_id: Property.ShortText({
+ displayName: 'Template ID',
+ description: 'The id of the template to fetch, for example 12.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { template_id } = context.propsValue;
+
+ try {
+ const template = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: `/smtp/templates/${encodeURIComponent(template_id)}`,
+ });
+
+ return { found: true, data: template };
+ } catch (error) {
+ if (error instanceof HttpError && error.response.status === 404) {
+ return { found: false, data: {} };
+ }
+ throw error;
+ }
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/get-sms-campaign.ts b/packages/pieces/community/sendinblue/src/lib/actions/get-sms-campaign.ts
new file mode 100644
index 00000000000..305de131461
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/get-sms-campaign.ts
@@ -0,0 +1,44 @@
+import { HttpError, HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { getSmsCampaignActionOutputSchema } from '../output-schemas';
+
+export const getSmsCampaign = createAction({
+ auth: sendinblueAuth,
+ name: 'get_sms_campaign',
+ outputSchema: getSmsCampaignActionOutputSchema,
+ classification: 'READ',
+ displayName: 'Get SMS Campaign',
+ description: 'Get the details of a single Brevo SMS campaign by id.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches a single Brevo SMS campaign by its numeric id, including its status, content, recipient targeting and statistics. Returns found:false instead of failing when the campaign id does not exist, so it is safe to branch on. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ campaign_id: Property.Number({
+ displayName: 'Campaign ID',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { campaign_id } = context.propsValue;
+
+ try {
+ const campaign = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: `/smsCampaigns/${campaign_id}`,
+ });
+
+ return { found: true, data: campaign };
+ } catch (error) {
+ if (error instanceof HttpError && error.response.status === 404) {
+ return { found: false, data: {} };
+ }
+ throw error;
+ }
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/import-contacts.ts b/packages/pieces/community/sendinblue/src/lib/actions/import-contacts.ts
new file mode 100644
index 00000000000..8ab68d87ac7
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/import-contacts.ts
@@ -0,0 +1,169 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { brevoProps } from '../common/props';
+import { importContactsActionOutputSchema } from '../output-schemas';
+
+export const importContacts = createAction({
+ auth: sendinblueAuth,
+ name: 'import_contacts',
+ outputSchema: importContactsActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Import Contacts',
+ description: 'Bulk import contacts into Brevo from a file URL or an inline list of rows.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Submits a bulk contact import job to Brevo, from a public file URL or an inline list of email/attribute rows, optionally into an existing or newly created list. This piece has no "get import status" action, so track completion via the Notify URL webhook or the Brevo dashboard. Not idempotent — each call submits a new background import job, even with identical input.',
+ idempotent: false,
+ },
+ props: {
+ file_url: Property.ShortText({
+ displayName: 'File URL',
+ description: 'Public URL of a .txt, .csv, or .json file containing the contacts to import. Mutually exclusive with Inline Contacts.',
+ required: false,
+ }),
+ json_body: Property.Array({
+ displayName: 'Inline Contacts',
+ description: 'Contact rows to import directly, without a file. Mutually exclusive with File URL.',
+ required: false,
+ properties: {
+ email: Property.ShortText({
+ displayName: 'Email',
+ required: true,
+ }),
+ attributes: Property.Json({
+ displayName: 'Attributes',
+ description: 'Attribute names and values for this contact, for eg: {"FNAME":"Elly"}.',
+ required: false,
+ }),
+ },
+ }),
+ list_ids: brevoProps.listIds({
+ displayName: 'Lists',
+ description: 'Existing lists to import into.',
+ }),
+ new_list_name: Property.ShortText({
+ displayName: 'New List Name',
+ description: 'Creates a new list with this name and imports into it. Requires New List Folder ID.',
+ required: false,
+ }),
+ new_list_folder_id: Property.Number({
+ displayName: 'New List Folder ID',
+ description: 'Folder to create the new list in. Requires New List Name.',
+ required: false,
+ }),
+ notify_url: Property.ShortText({
+ displayName: 'Notify URL',
+ description: 'A webhook URL Brevo calls once the import finishes.',
+ required: false,
+ }),
+ email_blacklist: Property.Checkbox({
+ displayName: 'Blacklist Imported Emails',
+ required: false,
+ defaultValue: false,
+ }),
+ sms_blacklist: Property.Checkbox({
+ displayName: 'Blacklist Imported SMS Numbers',
+ required: false,
+ defaultValue: false,
+ }),
+ update_existing_contacts: Property.Checkbox({
+ displayName: 'Update Existing Contacts',
+ required: false,
+ defaultValue: true,
+ }),
+ empty_contacts_attributes: Property.Checkbox({
+ displayName: 'Reset Attributes on Existing Contacts',
+ description: 'Blank out attributes not present in the import for contacts that already exist.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run(context) {
+ const {
+ file_url,
+ json_body,
+ list_ids,
+ new_list_name,
+ new_list_folder_id,
+ notify_url,
+ email_blacklist,
+ sms_blacklist,
+ update_existing_contacts,
+ empty_contacts_attributes,
+ } = context.propsValue;
+
+ const listIds = (list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const jsonBody = (json_body ?? [])
+ .map((row) => toImportRow(row))
+ .filter((row): row is ImportRow => row !== null);
+
+ if (isNil(file_url) && jsonBody.length === 0) {
+ throw new Error(
+ 'Provide either a File URL or at least one inline contact row with a valid email.',
+ );
+ }
+
+ const newList =
+ new_list_name && !isNil(new_list_folder_id)
+ ? { listName: new_list_name, folderId: new_list_folder_id }
+ : undefined;
+
+ if (listIds.length === 0 && isNil(newList)) {
+ throw new Error(
+ 'Provide at least one existing list in Lists, or both New List Name and New List Folder ID, to import into.',
+ );
+ }
+
+ const body = {
+ fileUrl: file_url,
+ jsonBody: jsonBody.length > 0 ? jsonBody : undefined,
+ listIds: listIds.length > 0 ? listIds : undefined,
+ newList,
+ notifyUrl: notify_url,
+ emailBlacklist: email_blacklist,
+ smsBlacklist: sms_blacklist,
+ updateExistingContacts: update_existing_contacts,
+ emptyContactsAttributes: empty_contacts_attributes,
+ };
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ resourceUri: '/contacts/import',
+ body,
+ });
+ },
+});
+
+function isRecord(value: unknown): value is Record<string, unknown> {
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
+}
+
+function toImportRow(row: unknown): ImportRow | null {
+ if (!isRecord(row)) {
+ return null;
+ }
+
+ const email = row['email'];
+ if (typeof email !== 'string' || email.trim().length === 0) {
+ return null;
+ }
+
+ const attributes = row['attributes'];
+
+ return {
+ email,
+ attributes: isRecord(attributes) ? attributes : undefined,
+ };
+}
+
+type ImportRow = {
+ email: string;
+ attributes?: Record<string, unknown>;
+};
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-companies.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-companies.ts
new file mode 100644
index 00000000000..3738481aa37
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-companies.ts
@@ -0,0 +1,92 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listCompaniesActionOutputSchema } from '../output-schemas';
+
+export const listCompanies = createAction({
+ auth: sendinblueAuth,
+ name: 'list_companies',
+ outputSchema: listCompaniesActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Companies',
+ description: 'List and filter Brevo CRM companies.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Brevo CRM companies with pagination, sorting and an optional raw filter string, and can filter by linked contact or deal ids. Use this to find a company id before calling Get Company, Delete Company, or to check whether a company already exists before Create Company. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ page: Property.Number({
+ displayName: 'Page',
+ description: '1-based page index.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Number of companies to return per page. Maximum 100.',
+ required: false,
+ defaultValue: 50,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort order for the results.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ }),
+ sort_by: Property.ShortText({
+ displayName: 'Sort By',
+ description: 'Field to sort by, e.g. createdAt or name.',
+ required: false,
+ }),
+ filters: Property.ShortText({
+ displayName: 'Filters',
+ description:
+ 'Raw JSON filter string per Brevo\'s docs, e.g. {"attributes.name":"Acme"}.',
+ required: false,
+ }),
+ linked_contacts_ids: Property.Array({
+ displayName: 'Linked Contact IDs',
+ description: 'Only return companies linked to any of these Brevo contact ids.',
+ required: false,
+ }),
+ linked_deals_ids: Property.Array({
+ displayName: 'Linked Deal IDs',
+ description: 'Only return companies linked to any of these Brevo deal ids.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { page, limit, sort, sort_by, filters, linked_contacts_ids, linked_deals_ids } =
+ context.propsValue;
+
+ const linkedContactsIds = (linked_contacts_ids ?? [])
+ .map((contactId) => Number(contactId))
+ .filter((contactId) => Number.isFinite(contactId));
+
+ const linkedDealsIds = (Array.isArray(linked_deals_ids) ? linked_deals_ids : [])
+ .map((dealId) => String(dealId).trim())
+ .filter((dealId) => dealId.length > 0);
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/companies',
+ query: {
+ page,
+ limit,
+ sort,
+ sortBy: sort_by,
+ filters,
+ linkedContactsIds: linkedContactsIds.length > 0 ? linkedContactsIds.join(',') : undefined,
+ linkedDealsIds: linkedDealsIds.length > 0 ? linkedDealsIds.join(',') : undefined,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-contact-attributes.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-contact-attributes.ts
new file mode 100644
index 00000000000..184473474fe
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-contact-attributes.ts
@@ -0,0 +1,28 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listContactAttributesActionOutputSchema } from '../output-schemas';
+
+export const listContactAttributes = createAction({
+ auth: sendinblueAuth,
+ name: 'list_contact_attributes',
+ outputSchema: listContactAttributesActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Contact Attributes',
+ description: 'List all contact attributes configured in the Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists every contact attribute configured in the Brevo account, with its category and type. Use this before calling create_or_update_contact or update_contact to discover valid attribute names, since Brevo rejects attributes that do not already exist. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/contacts/attributes',
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-contact-lists.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-contact-lists.ts
new file mode 100644
index 00000000000..974a146ee36
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-contact-lists.ts
@@ -0,0 +1,61 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listContactListsActionOutputSchema } from '../output-schemas';
+
+export const listContactLists = createAction({
+ auth: sendinblueAuth,
+ name: 'list_contact_lists',
+ outputSchema: listContactListsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Contact Lists',
+ description: 'List the contact lists in the Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Brevo contact lists with their id, name, folder id and subscriber counts. This is the way to resolve a list name to the numeric list id that other actions such as Create Contact List, Get Contact List or contact management actions require. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Number of lists to return per page. Maximum 50. Defaults to 10.',
+ required: false,
+ defaultValue: 10,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Index of the first list to return. Defaults to 0.',
+ required: false,
+ defaultValue: 0,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort order for the results, based on the list creation date.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { limit, offset, sort } = context.propsValue;
+
+ const response = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/contacts/lists',
+ query: {
+ limit,
+ offset,
+ sort,
+ },
+ });
+
+ return response;
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-contacts.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-contacts.ts
new file mode 100644
index 00000000000..8ea7259f509
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-contacts.ts
@@ -0,0 +1,88 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listContactsActionOutputSchema } from '../output-schemas';
+
+export const listContacts = createAction({
+ auth: sendinblueAuth,
+ name: 'list_contacts',
+ outputSchema: listContactsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Contacts',
+ description: 'List contacts in a Brevo account, optionally filtered by list, segment, or modification date.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Brevo contacts, optionally filtered by list membership, segment, creation date, or last modification date, with pagination and sort control. Use this to discover contacts matching criteria before acting on them with other contact actions. List and segment filters are mutually exclusive per Brevo. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ list_ids: Property.Array({
+ displayName: 'List IDs',
+ description: 'Only return contacts belonging to these list IDs. Mutually exclusive with Segment ID.',
+ required: false,
+ }),
+ segment_id: Property.ShortText({
+ displayName: 'Segment ID',
+ description: 'Only return contacts belonging to this segment. Mutually exclusive with List IDs.',
+ required: false,
+ }),
+ created_since: Property.DateTime({
+ displayName: 'Created Since',
+ description: 'Only return contacts created on or after this date.',
+ required: false,
+ }),
+ modified_since: Property.DateTime({
+ displayName: 'Modified Since',
+ description: 'Only return contacts modified on or after this date.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Number of contacts to return. Maximum 1000.',
+ required: false,
+ defaultValue: 50,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of contacts to skip, for pagination.',
+ required: false,
+ defaultValue: 0,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort contacts on their creation date.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { list_ids, segment_id, created_since, modified_since, limit, offset, sort } =
+ context.propsValue;
+
+ const listIds = (list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/contacts',
+ query: {
+ listIds: listIds.length > 0 ? listIds.join(',') : undefined,
+ segmentId: segment_id ? Number(segment_id) : undefined,
+ createdSince: created_since,
+ modifiedSince: modified_since,
+ limit,
+ offset,
+ sort,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-crm-notes.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-crm-notes.ts
new file mode 100644
index 00000000000..f16a6b61b67
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-crm-notes.ts
@@ -0,0 +1,94 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listCrmNotesActionOutputSchema } from '../output-schemas';
+
+export const listCrmNotes = createAction({
+ auth: sendinblueAuth,
+ name: 'list_crm_notes',
+ outputSchema: listCrmNotesActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List CRM Notes',
+ description: 'List the CRM notes in the Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Brevo CRM notes, optionally restricted to notes attached to a company, deal or contact entity and to a date range. Use this to review or audit notes already logged on a CRM record instead of guessing their content. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ entity: Property.StaticDropdown({
+ displayName: 'Entity Type',
+ description: 'Restrict to notes attached to this entity type.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Companies', value: 'companies' },
+ { label: 'Deals', value: 'deals' },
+ { label: 'Contacts', value: 'contacts' },
+ ],
+ },
+ }),
+ entity_ids: Property.ShortText({
+ displayName: 'Entity IDs',
+ description:
+ 'Comma-separated entity IDs to filter by, e.g. a specific company or contact id.',
+ required: false,
+ }),
+ date_from: Property.Number({
+ displayName: 'Date From',
+ description: 'Unix timestamp in milliseconds.',
+ required: false,
+ }),
+ date_to: Property.Number({
+ displayName: 'Date To',
+ description: 'Unix timestamp in milliseconds.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Number of notes to return per page. Defaults to 50.',
+ required: false,
+ defaultValue: 50,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Index of the first note to return. Defaults to 0.',
+ required: false,
+ defaultValue: 0,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort order for the results, based on the note creation date.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { entity, entity_ids, date_from, date_to, limit, offset, sort } =
+ context.propsValue;
+
+ const response = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/crm/notes',
+ query: {
+ entity,
+ entityIds: entity_ids,
+ dateFrom: date_from,
+ dateTo: date_to,
+ limit,
+ offset,
+ sort,
+ },
+ });
+
+ return response;
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-email-campaigns.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-email-campaigns.ts
new file mode 100644
index 00000000000..f768c18b40b
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-email-campaigns.ts
@@ -0,0 +1,105 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listEmailCampaignsActionOutputSchema } from '../output-schemas';
+
+export const listEmailCampaigns = createAction({
+ auth: sendinblueAuth,
+ name: 'list_email_campaigns',
+ outputSchema: listEmailCampaignsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Email Campaigns',
+ description: 'List email campaigns in the Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Brevo email campaigns with optional filters by type, status and date range, returning each campaign id, name, status and subject. Use this to resolve a campaign name to the numeric id that Get Email Campaign, Update Email Campaign and Send Email Campaign Now require. Start Date and End Date only narrow results when Status is "Sent" or left empty. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ required: false,
+ options: {
+ options: [
+ { label: 'Classic', value: 'classic' },
+ { label: 'Trigger', value: 'trigger' },
+ ],
+ },
+ }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: {
+ options: [
+ { label: 'Suspended', value: 'suspended' },
+ { label: 'Archive', value: 'archive' },
+ { label: 'Sent', value: 'sent' },
+ { label: 'Queued', value: 'queued' },
+ { label: 'Draft', value: 'draft' },
+ { label: 'In Process', value: 'inProcess' },
+ { label: 'In Review', value: 'inReview' },
+ ],
+ },
+ }),
+ start_date: Property.DateTime({
+ displayName: 'Start Date',
+ description: 'Only applies when Status is "Sent" or left empty.',
+ required: false,
+ }),
+ end_date: Property.DateTime({
+ displayName: 'End Date',
+ description: 'Only applies when Status is "Sent" or left empty.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Number of campaigns to return per page. Maximum 100. Defaults to 50.',
+ required: false,
+ defaultValue: 50,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Index of the first campaign to return. Defaults to 0.',
+ required: false,
+ defaultValue: 0,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort order for the results, based on the campaign creation date.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ }),
+ exclude_html_content: Property.Checkbox({
+ displayName: 'Exclude HTML Content',
+ description: 'Leave the HTML content out of each campaign in the response.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { type, status, start_date, end_date, limit, offset, sort, exclude_html_content } =
+ context.propsValue;
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/emailCampaigns',
+ query: {
+ type,
+ status,
+ startDate: start_date,
+ endDate: end_date,
+ limit,
+ offset,
+ sort,
+ excludeHtmlContent: exclude_html_content,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-email-templates.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-email-templates.ts
new file mode 100644
index 00000000000..8cfa802c5b3
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-email-templates.ts
@@ -0,0 +1,66 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listEmailTemplatesActionOutputSchema } from '../output-schemas';
+
+export const listEmailTemplates = createAction({
+ auth: sendinblueAuth,
+ name: 'list_email_templates',
+ outputSchema: listEmailTemplatesActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Email Templates',
+ description: 'List email templates in your Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Brevo email templates, optionally filtered to only active or only inactive ones. Use Get Email Template to fetch the full details of one template once you have its id from this list. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ template_status: Property.Checkbox({
+ displayName: 'Template Status',
+ description:
+ 'Filter to active (checked) or inactive (unchecked) templates; leave unset to return both.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of templates to return. Defaults to 50, max 1000.',
+ required: false,
+ defaultValue: 50,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of templates to skip before starting to return results.',
+ required: false,
+ defaultValue: 0,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort order applied to the results, based on creation date.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { template_status, limit, offset, sort } = context.propsValue;
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/smtp/templates',
+ query: {
+ templateStatus: template_status,
+ limit,
+ offset,
+ sort,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-sender-domains.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-sender-domains.ts
new file mode 100644
index 00000000000..659f4f3c4aa
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-sender-domains.ts
@@ -0,0 +1,30 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listSenderDomainsActionOutputSchema } from '../output-schemas';
+
+export const listSenderDomains = createAction({
+ auth: sendinblueAuth,
+ name: 'list_sender_domains',
+ outputSchema: listSenderDomainsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Sender Domains',
+ description: 'List the sender domains configured in the Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists every sender domain configured in the Brevo account along with its authentication and verification status. Use this to check whether a domain is verified before sending from it, rather than guessing its DNS setup state. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ const response = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/senders/domains',
+ });
+
+ return response;
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-senders.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-senders.ts
new file mode 100644
index 00000000000..0bc965fe75d
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-senders.ts
@@ -0,0 +1,48 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listSendersActionOutputSchema } from '../output-schemas';
+
+export const listSenders = createAction({
+ auth: sendinblueAuth,
+ name: 'list_senders',
+ outputSchema: listSendersActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Senders',
+ description: 'List the verified senders in the Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists every verified sender configured in the Brevo account, optionally filtered by dedicated IP or sender domain. This is the standalone way to see all senders; the Send Transactional Email action uses this same endpoint internally to populate its sender dropdown. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ ip: Property.ShortText({
+ displayName: 'IP',
+ description:
+ 'Filter by a specific dedicated IP; dedicated-IP accounts only.',
+ required: false,
+ }),
+ domain: Property.ShortText({
+ displayName: 'Domain',
+ description: 'Filter by sender domain.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { ip, domain } = context.propsValue;
+
+ const response = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/senders',
+ query: {
+ ip,
+ domain,
+ },
+ });
+
+ return response;
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-sms-campaigns.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-sms-campaigns.ts
new file mode 100644
index 00000000000..4a669f152f5
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-sms-campaigns.ts
@@ -0,0 +1,86 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listSmsCampaignsActionOutputSchema } from '../output-schemas';
+
+export const listSmsCampaigns = createAction({
+ auth: sendinblueAuth,
+ name: 'list_sms_campaigns',
+ outputSchema: listSmsCampaignsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List SMS Campaigns',
+ description: 'List the SMS campaigns in the Brevo account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Brevo SMS campaigns with their id, name, status and statistics, optionally filtered by status or sent date range. Use this to resolve a campaign name to the numeric id that Get SMS Campaign and Delete SMS Campaign require. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: {
+ options: [
+ { label: 'Sent', value: 'sent' },
+ { label: 'Draft', value: 'draft' },
+ { label: 'Queued', value: 'queued' },
+ { label: 'Suspended', value: 'suspended' },
+ { label: 'In Process', value: 'inProcess' },
+ { label: 'Archive', value: 'archive' },
+ ],
+ },
+ }),
+ start_date: Property.DateTime({
+ displayName: 'Start Date',
+ description: 'Only filters sent campaigns; both required together.',
+ required: false,
+ }),
+ end_date: Property.DateTime({
+ displayName: 'End Date',
+ description: 'Only filters sent campaigns; both required together.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Number of campaigns to return per page. Maximum 1000.',
+ required: false,
+ defaultValue: 500,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Index of the first campaign to return. Defaults to 0.',
+ required: false,
+ defaultValue: 0,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort order for the results, based on the campaign creation date.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { status, start_date, end_date, limit, offset, sort } = context.propsValue;
+
+ return await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/smsCampaigns',
+ query: {
+ status,
+ startDate: start_date,
+ endDate: end_date,
+ limit,
+ offset,
+ sort,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/list-transactional-email-events.ts b/packages/pieces/community/sendinblue/src/lib/actions/list-transactional-email-events.ts
new file mode 100644
index 00000000000..616c7d82c91
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/list-transactional-email-events.ts
@@ -0,0 +1,148 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { listTransactionalEmailEventsActionOutputSchema } from '../output-schemas';
+
+export const listTransactionalEmailEvents = createAction({
+ auth: sendinblueAuth,
+ name: 'list_transactional_email_events',
+ outputSchema: listTransactionalEmailEventsActionOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Transactional Email Events',
+ description: 'List transactional email events (delivered, opened, clicked, bounced, etc) from Brevo.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists historical transactional email events (delivery, open, click, bounce, spam and similar), optionally filtered by recipient, event type, tags, message id or template. Use this to pull events already recorded by Brevo on demand instead of waiting for the email_delivered/email_opened/email_clicked/email_bounced webhook triggers, for example to audit a specific send or backfill data from before a webhook was configured. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ days: Property.Number({
+ displayName: 'Days',
+ description:
+ 'Number of past days to include, 1-90. Cannot be combined with Start Date/End Date. Brevo defaults to 30 days if none of days, start date or end date are given.',
+ required: false,
+ }),
+ start_date: Property.ShortText({
+ displayName: 'Start Date',
+ description:
+ "Start of the date range, format 'YYYY-MM-DD'. Must be given together with End Date, and cannot be combined with Days. The range is capped at 90 days.",
+ required: false,
+ }),
+ end_date: Property.ShortText({
+ displayName: 'End Date',
+ description:
+ "End of the date range, format 'YYYY-MM-DD'. Must be given together with Start Date, and cannot be combined with Days. The range is capped at 90 days.",
+ required: false,
+ }),
+ email: Property.ShortText({
+ displayName: 'Email',
+ description: 'Filter events down to a single recipient email address.',
+ required: false,
+ }),
+ event: Property.StaticDropdown({
+ displayName: 'Event',
+ description: 'Filter down to a single event type.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Bounces', value: 'bounces' },
+ { label: 'Hard Bounces', value: 'hardBounces' },
+ { label: 'Soft Bounces', value: 'softBounces' },
+ { label: 'Delivered', value: 'delivered' },
+ { label: 'Spam', value: 'spam' },
+ { label: 'Requests', value: 'requests' },
+ { label: 'Opened', value: 'opened' },
+ { label: 'Clicks', value: 'clicks' },
+ { label: 'Invalid', value: 'invalid' },
+ { label: 'Deferred', value: 'deferred' },
+ { label: 'Blocked', value: 'blocked' },
+ { label: 'Unsubscribed', value: 'unsubscribed' },
+ { label: 'Error', value: 'error' },
+ { label: 'Loaded By Proxy', value: 'loadedByProxy' },
+ ],
+ },
+ }),
+ tags: Property.ShortText({
+ displayName: 'Tags',
+ description: 'Comma-separated tags to filter events by.',
+ required: false,
+ }),
+ message_id: Property.ShortText({
+ displayName: 'Message ID',
+ description: 'Filter events down to a single message id.',
+ required: false,
+ }),
+ template_id: Property.Number({
+ displayName: 'Template ID',
+ description: 'Filter events down to emails sent from this template id.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Number of events to return per page. Defaults to 50, maximum 5000.',
+ required: false,
+ defaultValue: 50,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Index of the first event to return. Defaults to 0.',
+ required: false,
+ defaultValue: 0,
+ }),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ description: 'Sort order for the results, based on the event date.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Ascending', value: 'asc' },
+ { label: 'Descending', value: 'desc' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const {
+ days,
+ start_date,
+ end_date,
+ email,
+ event,
+ tags,
+ message_id,
+ template_id,
+ limit,
+ offset,
+ sort,
+ } = context.propsValue;
+
+ if (!isNil(days) && (!isNil(start_date) || !isNil(end_date))) {
+ throw new Error(
+ 'Provide either days, or start_date and end_date together, not both',
+ );
+ }
+
+ const response = await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.GET,
+ resourceUri: '/smtp/statistics/events',
+ query: {
+ limit,
+ offset,
+ startDate: start_date,
+ endDate: end_date,
+ days,
+ email,
+ event,
+ tags,
+ messageId: message_id,
+ templateId: template_id,
+ sort,
+ },
+ });
+
+ return response;
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/send-email-campaign-now.ts b/packages/pieces/community/sendinblue/src/lib/actions/send-email-campaign-now.ts
new file mode 100644
index 00000000000..1e435d1ba6a
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/send-email-campaign-now.ts
@@ -0,0 +1,36 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+
+export const sendEmailCampaignNow = createAction({
+ auth: sendinblueAuth,
+ name: 'send_email_campaign_now',
+ classification: 'WRITE',
+ displayName: 'Send Email Campaign Now',
+ description: 'Immediately send a draft Brevo email campaign to its recipient lists.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Immediately sends the given Brevo email campaign to every contact in its recipient lists, with no confirmation step and no way to recall it once sent. The campaign must currently be a draft. Not idempotent — retrying after a successful send fails because the campaign is no longer a draft, and a second successful call would email every recipient twice.',
+ idempotent: false,
+ },
+ props: {
+ campaign_id: Property.Number({
+ displayName: 'Campaign ID',
+ description: 'Must currently be a draft campaign.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { campaign_id } = context.propsValue;
+
+ await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.POST,
+ resourceUri: `/emailCampaigns/${campaign_id}/sendNow`,
+ });
+
+ return { success: true };
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/update-contact.ts b/packages/pieces/community/sendinblue/src/lib/actions/update-contact.ts
new file mode 100644
index 00000000000..cffaa8fca88
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/update-contact.ts
@@ -0,0 +1,122 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { brevoProps } from '../common/props';
+import { updateContactActionOutputSchema } from '../output-schemas';
+
+export const updateContact = createAction({
+ auth: sendinblueAuth,
+ name: 'update_contact',
+ outputSchema: updateContactActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Update Contact',
+ description: 'Update an existing Brevo contact by email, phone, contact id, external id, WhatsApp id, or landline number.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Updates an existing Brevo contact identified by email, phone number, contact id, external id, WhatsApp id or landline number, setting attributes, list membership, blacklist flags, or a new external id. This complements create_or_update_contact: use create_or_update_contact when you only have an email and want create-or-update semantics; use update_contact when you need to update by an identifier other than email, or want a hard 404 failure instead of silently creating a new contact. Idempotent — re-applying the same values converges on the same contact state.',
+ idempotent: true,
+ },
+ props: {
+ identifier: Property.ShortText({
+ displayName: 'Identifier',
+ description: 'The value to look the contact up by, for example an email address.',
+ required: true,
+ }),
+ identifier_type: Property.StaticDropdown({
+ displayName: 'Identifier Type',
+ description: 'How the identifier above should be interpreted.',
+ required: false,
+ defaultValue: 'email_id',
+ options: {
+ options: [
+ { label: 'Email', value: 'email_id' },
+ { label: 'Phone (SMS)', value: 'phone_id' },
+ { label: 'Contact ID', value: 'contact_id' },
+ { label: 'External ID', value: 'ext_id' },
+ { label: 'WhatsApp', value: 'whatsapp_id' },
+ { label: 'Landline Number', value: 'landline_number_id' },
+ ],
+ },
+ }),
+ attributes: Property.Object({
+ displayName: 'Attributes',
+ description: `Pass the set of attributes and their values. Attribute names must already exist in your Brevo account and be passed in capital letters, for eg: {"FNAME":"Elly", "LNAME":"Roger"}. Only the attributes you list are changed; the rest are left as they are.`,
+ required: false,
+ }),
+ ext_id: Property.ShortText({
+ displayName: 'External ID',
+ description: 'Sets a new external id for the contact.',
+ required: false,
+ }),
+ email_blacklisted: Property.Checkbox({
+ displayName: 'Email Blacklisted?',
+ description: `Set this field to blacklist the contact for emails (emailBlacklisted = true). Leave untouched to keep the contact's current setting.`,
+ required: false,
+ }),
+ sms_blacklisted: Property.Checkbox({
+ displayName: 'SMS Blacklisted?',
+ description: `Set this field to blacklist the contact for SMS (smsBlacklisted = true). Leave untouched to keep the contact's current setting.`,
+ required: false,
+ }),
+ list_ids: brevoProps.listIds({
+ displayName: 'Add to Lists',
+ description: 'Lists to add the contact to.',
+ }),
+ unlink_list_ids: brevoProps.listIds({
+ displayName: 'Remove from Lists',
+ description: 'Lists to remove the contact from.',
+ }),
+ blocked_sender_addresses: Property.Array({
+ displayName: 'Blocked Sender Addresses',
+ description: `Sender email addresses this contact must not receive transactional email from. Leave empty to change nothing.`,
+ required: false,
+ }),
+ },
+ async run(context) {
+ const {
+ identifier,
+ identifier_type,
+ attributes,
+ ext_id,
+ email_blacklisted,
+ sms_blacklisted,
+ list_ids,
+ unlink_list_ids,
+ blocked_sender_addresses,
+ } = context.propsValue;
+
+ const listIds = (list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const unlinkListIds = (unlink_list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const blockedSenders = (Array.isArray(blocked_sender_addresses) ? blocked_sender_addresses : [])
+ .map((sender) => String(sender).trim())
+ .filter((sender) => sender.length > 0);
+
+ const body = {
+ ext_id,
+ attributes: brevoCommon.isEmptyObject(attributes) ? undefined : attributes,
+ emailBlacklisted: email_blacklisted,
+ smsBlacklisted: sms_blacklisted,
+ listIds: listIds.length > 0 ? listIds : undefined,
+ unlinkListIds: unlinkListIds.length > 0 ? unlinkListIds : undefined,
+ smtpBlacklistSender: blockedSenders.length > 0 ? blockedSenders : undefined,
+ };
+
+ await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ resourceUri: `/contacts/${encodeURIComponent(identifier)}`,
+ query: { identifierType: identifier_type },
+ body,
+ });
+
+ return { success: true };
+ },
+});
diff --git a/packages/pieces/community/sendinblue/src/lib/actions/update-email-campaign.ts b/packages/pieces/community/sendinblue/src/lib/actions/update-email-campaign.ts
new file mode 100644
index 00000000000..e742e417684
--- /dev/null
+++ b/packages/pieces/community/sendinblue/src/lib/actions/update-email-campaign.ts
@@ -0,0 +1,197 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, isNil, Property } from '@activepieces/pieces-framework';
+import { sendinblueAuth } from '../auth';
+import { brevoCommon } from '../common';
+import { brevoProps } from '../common/props';
+import { updateEmailCampaignActionOutputSchema } from '../output-schemas';
+
+export const updateEmailCampaign = createAction({
+ auth: sendinblueAuth,
+ name: 'update_email_campaign',
+ outputSchema: updateEmailCampaignActionOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Update Email Campaign',
+ description: 'Update an existing Brevo email campaign.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Updates fields on an existing Brevo email campaign such as its name, subject, content, recipient lists or schedule. Only the fields you provide are changed; omitted fields are left untouched. Use before Send Email Campaign Now to adjust a draft. Idempotent — re-applying the same values converges on the same state.',
+ idempotent: true,
+ },
+ props: {
+ campaign_id: Property.Number({
+ displayName: 'Campaign ID',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Internal campaign name shown only in the Brevo dashboard, not to recipients.',
+ required: false,
+ }),
+ sender_email: brevoProps.senderEmail,
+ sender_name: Property.ShortText({
+ displayName: 'Sender Name',
+ description: 'Overrides the display name of the selected sender.',
+ required: false,
+ }),
+ sender_id: Property.Number({
+ displayName: 'Sender ID',
+ description:
+ 'Alternative to Sender Email/Sender Name: an existing Brevo sender id. Provide one or the other, not both.',
+ required: false,
+ }),
+ subject: Property.ShortText({
+ displayName: 'Subject',
+ description: 'Subject line shown to recipients.',
+ required: false,
+ }),
+ html_content: Property.LongText({
+ displayName: 'HTML Content',
+ description: 'Mutually exclusive with HTML URL.',
+ required: false,
+ }),
+ html_url: Property.ShortText({
+ displayName: 'HTML URL',
+ description: 'URL Brevo fetches the HTML content from. Mutually exclusive with HTML Content.',
+ required: false,
+ }),
+ list_ids: brevoProps.listIds({
+ displayName: 'Recipient Lists',
+ description: 'Contact lists to send this campaign to.',
+ }),
+ exclusion_list_ids: brevoProps.listIds({
+ displayName: 'Exclude Lists',
+ description:
+ 'Contact lists to exclude from this campaign, even if a contact also belongs to a recipient list.',
+ }),
+ scheduled_at: Property.DateTime({
+ displayName: 'Scheduled At',
+ description: 'Schedule the send; omit to leave the current schedule untouched.',
+ required: false,
+ }),
+ reply_to_email: Property.ShortText({
+ displayName: 'Reply To',
+ description: 'Email address replies are sent to, if different from the sender.',
+ required: false,
+ }),
+ preview_text: Property.ShortText({
+ displayName: 'Preview Text',
+ description: 'Preheader text shown next to the subject line in most inboxes.',
+ required: false,
+ }),
+ to_field: Property.ShortText({
+ displayName: 'To Field',
+ description:
+ "Overrides how the recipient's name/email appears in the To field, e.g. \"{{contact.FIRSTNAME}}\".",
+ required: false,
+ }),
+ params: Property.Object({
+ displayName: 'Template Parameters',
+ description: 'Personalization variables available when the campaign uses a template.',
+ required: false,
+ }),
+ footer: Property.LongText({
+ displayName: 'Footer',
+ description: 'HTML footer appended to the campaign, typically the unsubscribe link and address.',
+ required: false,
+ }),
+ header: Property.LongText({
+ displayName: 'Header',
+ description: 'HTML header prepended to the campaign.',
+ required: false,
+ }),
+ utm_campaign: Property.ShortText({
+ displayName: 'UTM Campaign',
+ description: 'Value used for the utm_campaign tracking parameter on links in this email.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const {
+ campaign_id,
+ name,
+ sender_email,
+ sender_name,
+ sender_id,
+ subject,
+ html_content,
+ html_url,
+ list_ids,
+ exclusion_list_ids,
+ scheduled_at,
+ reply_to_email,
+ preview_text,
+ to_field,
+ params,
+ footer,
+ header,
+ utm_campaign,
+ } = context.propsValue;
+
+ if (!isNil(sender_id) && !isNil(sender_email)) {
+ throw new Error('Provide Sender ID or Sender Email, not both.');
+ }
+
+ if (!isNil(html_content) && !isNil(html_url)) {
+ throw new Error('Provide HTML Content or HTML URL, not both.');
+ }
+
+ const listIds = (list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const exclusionListIds = (exclusion_list_ids ?? [])
+ .map((listId) => Number(listId))
+ .filter((listId) => Number.isFinite(listId));
+
+ const body = {
+ name: name ?? undefined,
+ sender: buildSender({ sender_id, sender_email, sender_name }),
+ subject: subject ?? undefined,
+ htmlContent: html_content ?? undefined,
+ htmlUrl: html_url ?? undefined,
+ recipients:
+ listIds.length > 0 || exclusionListIds.length > 0
+ ? {
+ listIds: listIds.length > 0 ? listIds : undefined,
+ exclusionListIds: exclusionListIds.length > 0 ? exclusionListIds : undefined,
+ }
+ : undefined,
+ scheduledAt: scheduled_at ?? undefined,
+ replyTo: reply_to_email ?? undefined,
+ previewText: preview_text ?? undefined,
+ toField: to_field ?? undefined,
+ params: brevoCommon.isEmptyObject(params) ? undefined : params,
+ footer: footer ?? undefined,
+ header: header ?? undefined,
+ utmCampaign: utm_campaign ?? undefined,
+ };
+
+ await brevoCommon.apiCall({
+ apiKey: context.auth.secret_text,
+ method: HttpMethod.PUT,
+ resourceUri: `/emailCampaigns/${campaign_id}`,
+ body,
+ });
+
+ return { success: true };
+ },
+});
+
+function buildSender({
+ sender_id,
+ sender_email,
+ sender_name,
+}: {
+ sender_id: number | undefined;
+ sender_email: string | undefined;
+ sender_name: string | undefined;
+}): { id: number } | { email: string; name?: string } | undefined {
+ if (!isNil(sender_id)) {
+ return { id: sender_id };
+ }
+ if (!isNil(sender_email)) {
+ return { email: sender_email, name: sender_name ?? undefined };
+ }
+ return undefined;
+}
diff --git a/packages/pieces/community/sendinblue/src/lib/output-schemas.ts b/packages/pieces/community/sendinblue/src/lib/output-schemas.ts
index 9519cf32214..741c7f01513 100644
--- a/packages/pieces/community/sendinblue/src/lib/output-schemas.ts
+++ b/packages/pieces/community/sendinblue/src/lib/output-schemas.ts
@@ -177,3 +177,387 @@ export const emailClickedTriggerOutputSchema: OutputSchema = {
{ key: 'link', label: 'Clicked Link', format: 'url' },
],
};
+
+const senderRefFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Sender ID' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'name', label: 'Name' },
+];
+
+const emailTemplateFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Template ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'subject', label: 'Subject' },
+ { key: 'isActive', label: 'Active', format: 'boolean' },
+ { key: 'sender', label: 'Sender', children: senderRefFields },
+ { key: 'replyTo', label: 'Reply To' },
+ { key: 'htmlContent', label: 'HTML Content', format: 'html' },
+ { key: 'tag', label: 'Tag' },
+ { key: 'createdAt', label: 'Created At', format: 'datetime' },
+ { key: 'modifiedAt', label: 'Modified At', format: 'datetime' },
+];
+
+const campaignGlobalStatsFields: OutputSchema['fields'] = [
+ { key: 'sent', label: 'Sent', format: 'number' },
+ { key: 'delivered', label: 'Delivered', format: 'number' },
+ { key: 'viewed', label: 'Viewed', format: 'number' },
+ { key: 'uniqueViews', label: 'Unique Views', format: 'number' },
+ { key: 'clickers', label: 'Clickers', format: 'number' },
+ { key: 'uniqueClicks', label: 'Unique Clicks', format: 'number' },
+ { key: 'hardBounces', label: 'Hard Bounces', format: 'number' },
+ { key: 'softBounces', label: 'Soft Bounces', format: 'number' },
+ { key: 'unsubscriptions', label: 'Unsubscriptions', format: 'number' },
+ { key: 'complaints', label: 'Complaints', format: 'number' },
+ { key: 'opensRate', label: 'Opens Rate', format: 'number' },
+];
+
+const emailCampaignFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Campaign ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'subject', label: 'Subject' },
+ { key: 'type', label: 'Type' },
+ { key: 'status', label: 'Status' },
+ { key: 'sender', label: 'Sender', children: senderRefFields },
+ { key: 'htmlContent', label: 'HTML Content', format: 'html' },
+ { key: 'scheduledAt', label: 'Scheduled At', format: 'datetime' },
+ { key: 'createdAt', label: 'Created At', format: 'datetime' },
+ { key: 'modifiedAt', label: 'Modified At', format: 'datetime' },
+ {
+ key: 'recipients',
+ label: 'Recipients',
+ children: [
+ { key: 'lists', label: 'List IDs' },
+ { key: 'exclusionLists', label: 'Exclusion List IDs' },
+ ],
+ },
+ {
+ key: 'statistics',
+ label: 'Statistics',
+ children: [{ key: 'globalStats', label: 'Global Stats', children: campaignGlobalStatsFields }],
+ },
+];
+
+const smsCampaignFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Campaign ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'status', label: 'Status' },
+ { key: 'content', label: 'Content' },
+ { key: 'sender', label: 'Sender' },
+ { key: 'scheduledAt', label: 'Scheduled At', format: 'datetime' },
+ { key: 'createdAt', label: 'Created At', format: 'datetime' },
+ { key: 'modifiedAt', label: 'Modified At', format: 'datetime' },
+ {
+ key: 'recipients',
+ label: 'Recipients',
+ children: [
+ { key: 'lists', label: 'List IDs' },
+ { key: 'exclusionLists', label: 'Exclusion List IDs' },
+ ],
+ },
+ {
+ key: 'statistics',
+ label: 'Statistics',
+ children: [
+ { key: 'sent', label: 'Sent', format: 'number' },
+ { key: 'delivered', label: 'Delivered', format: 'number' },
+ { key: 'softBounces', label: 'Soft Bounces', format: 'number' },
+ { key: 'hardBounces', label: 'Hard Bounces', format: 'number' },
+ { key: 'unsubscriptions', label: 'Unsubscriptions', format: 'number' },
+ { key: 'answered', label: 'Answered', format: 'number' },
+ ],
+ },
+];
+
+const companyFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Company ID' },
+ { key: 'attributes', label: 'Attributes', dynamicKey: true },
+ { key: 'linkedContactsIds', label: 'Linked Contact IDs' },
+ { key: 'linkedDealsIds', label: 'Linked Deal IDs' },
+];
+
+export const listContactsActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'contacts', label: 'Contacts', listItems: contactFields, labelKey: 'email' },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const updateContactActionOutputSchema: OutputSchema = {
+ fields: [{ key: 'success', label: 'Success', format: 'boolean' }],
+};
+
+export const importContactsActionOutputSchema: OutputSchema = {
+ fields: [{ key: 'processId', label: 'Process ID', format: 'number' }],
+};
+
+export const listContactAttributesActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'attributes',
+ label: 'Attributes',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'category', label: 'Category' },
+ { key: 'type', label: 'Type' },
+ ],
+ labelKey: 'name',
+ },
+ ],
+};
+
+export const getContactCampaignStatsActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'opened', label: 'Opened' },
+ { key: 'clicked', label: 'Clicked' },
+ { key: 'delivered', label: 'Delivered' },
+ { key: 'complaints', label: 'Complaints' },
+ { key: 'hardBounces', label: 'Hard Bounces' },
+ { key: 'softBounces', label: 'Soft Bounces' },
+ { key: 'messagesSent', label: 'Messages Sent' },
+ { key: 'unsubscriptions', label: 'Unsubscriptions' },
+ { key: 'transacAttributes', label: 'Transactional Attributes' },
+ ],
+};
+
+export const createContactListActionOutputSchema: OutputSchema = {
+ fields: [{ key: 'id', label: 'List ID', format: 'number' }],
+};
+
+export const listContactListsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'lists',
+ label: 'Lists',
+ listItems: [
+ { key: 'id', label: 'List ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'folderId', label: 'Folder ID', format: 'number' },
+ { key: 'uniqueSubscribers', label: 'Unique Subscribers', format: 'number' },
+ { key: 'totalSubscribers', label: 'Total Subscribers', format: 'number' },
+ { key: 'totalBlacklisted', label: 'Total Blacklisted', format: 'number' },
+ ],
+ labelKey: 'name',
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const getContactListActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'found', label: 'Found', format: 'boolean' },
+ {
+ key: 'data',
+ label: 'List',
+ children: [
+ { key: 'id', label: 'List ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'folderId', label: 'Folder ID', format: 'number' },
+ { key: 'totalSubscribers', label: 'Total Subscribers', format: 'number' },
+ { key: 'uniqueSubscribers', label: 'Unique Subscribers', format: 'number' },
+ { key: 'totalBlacklisted', label: 'Total Blacklisted', format: 'number' },
+ { key: 'createdAt', label: 'Created At', format: 'datetime' },
+ { key: 'dynamicList', label: 'Dynamic List', format: 'boolean' },
+ ],
+ },
+ ],
+};
+
+export const createCompanyActionOutputSchema: OutputSchema = {
+ fields: [{ key: 'id', label: 'Company ID' }],
+};
+
+export const getCompanyActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'found', label: 'Found', format: 'boolean' },
+ { key: 'data', label: 'Company', children: companyFields },
+ ],
+};
+
+export const listCompaniesActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'items', label: 'Companies', listItems: companyFields, labelKey: 'id' },
+ {
+ key: 'pager',
+ label: 'Pager',
+ children: [
+ { key: 'current', label: 'Current Page', format: 'number' },
+ { key: 'limit', label: 'Limit', format: 'number' },
+ { key: 'count', label: 'Count', format: 'number' },
+ { key: 'total', label: 'Total', format: 'number' },
+ ],
+ },
+ ],
+};
+
+export const listCrmNotesActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'notes',
+ value: '',
+ label: 'Notes',
+ listItems: [
+ { key: 'id', label: 'Note ID' },
+ { key: 'text', label: 'Text' },
+ { key: 'contactIds', label: 'Contact IDs' },
+ { key: 'companyIds', label: 'Company IDs' },
+ { key: 'dealIds', label: 'Deal IDs' },
+ { key: 'createdAt', label: 'Created At', format: 'datetime' },
+ { key: 'updatedAt', label: 'Updated At', format: 'datetime' },
+ ],
+ },
+ ],
+ itemLabel: '{text}',
+};
+
+export const listSendersActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'senders',
+ label: 'Senders',
+ listItems: [
+ { key: 'id', label: 'Sender ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ ],
+ labelKey: 'email',
+ },
+ ],
+};
+
+export const listSenderDomainsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'domains',
+ label: 'Domains',
+ listItems: [
+ { key: 'id', label: 'Domain ID' },
+ { key: 'domain_name', label: 'Domain Name' },
+ { key: 'authenticated', label: 'Authenticated', format: 'boolean' },
+ { key: 'verified', label: 'Verified', format: 'boolean' },
+ ],
+ labelKey: 'domain_name',
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const createOrUpdateEmailTemplateActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Template ID', format: 'number' },
+ { key: 'success', label: 'Success', format: 'boolean' },
+ ],
+};
+
+export const getEmailTemplateActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'found', label: 'Found', format: 'boolean' },
+ { key: 'data', label: 'Template', children: emailTemplateFields },
+ ],
+};
+
+export const listEmailTemplatesActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'templates', label: 'Templates', listItems: emailTemplateFields, labelKey: 'name' },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const createEmailCampaignActionOutputSchema: OutputSchema = {
+ fields: [{ key: 'id', label: 'Campaign ID', format: 'number' }],
+};
+
+export const updateEmailCampaignActionOutputSchema: OutputSchema = {
+ fields: [{ key: 'success', label: 'Success', format: 'boolean' }],
+};
+
+export const getEmailCampaignActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'found', label: 'Found', format: 'boolean' },
+ { key: 'data', label: 'Campaign', children: emailCampaignFields },
+ ],
+};
+
+export const listEmailCampaignsActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'campaigns', label: 'Campaigns', listItems: emailCampaignFields, labelKey: 'name' },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const createSmsCampaignActionOutputSchema: OutputSchema = {
+ fields: [{ key: 'id', label: 'Campaign ID', format: 'number' }],
+};
+
+export const getSmsCampaignActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'found', label: 'Found', format: 'boolean' },
+ { key: 'data', label: 'SMS Campaign', children: smsCampaignFields },
+ ],
+};
+
+export const listSmsCampaignsActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'campaigns', label: 'SMS Campaigns', listItems: smsCampaignFields, labelKey: 'name' },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const listTransactionalEmailEventsActionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'events',
+ label: 'Events',
+ listItems: [
+ { key: 'email', label: 'Recipient', format: 'email' },
+ { key: 'event', label: 'Event Type' },
+ { key: 'date', label: 'Date', format: 'datetime' },
+ { key: 'subject', label: 'Subject' },
+ { key: 'messageId', label: 'Message ID' },
+ { key: 'from', label: 'From', format: 'email' },
+ { key: 'ip', label: 'IP' },
+ { key: 'reason', label: 'Reason' },
+ { key: 'link', label: 'Clicked Link', format: 'url' },
+ { key: 'templateId', label: 'Template ID', format: 'number' },
+ ],
+ labelKey: 'email',
+ },
+ ],
+};
+
+export const getAccountInfoActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'firstName', label: 'First Name' },
+ { key: 'lastName', label: 'Last Name' },
+ { key: 'companyName', label: 'Company Name' },
+ {
+ key: 'address',
+ label: 'Address',
+ children: [
+ { key: 'street', label: 'Street' },
+ { key: 'city', label: 'City' },
+ { key: 'zipCode', label: 'Zip Code' },
+ { key: 'country', label: 'Country' },
+ ],
+ },
+ {
+ key: 'plan',
+ label: 'Plan',
+ listItems: [
+ { key: 'type', label: 'Type' },
+ { key: 'credits', label: 'Credits', format: 'number' },
+ { key: 'creditsType', label: 'Credits Type' },
+ { key: 'startDate', label: 'Start Date' },
+ { key: 'endDate', label: 'End Date' },
+ ],
+ labelKey: 'type',
+ },
+ {
+ key: 'relay',
+ label: 'Relay',
+ children: [{ key: 'enabled', label: 'Relay Enabled', format: 'boolean' }],
+ },
+ { key: 'language', label: 'Language' },
+ ],
+};