//native
type Brevo = {
apiKey: string;
};
/**
* Send invitation to user
* `Feature` - A Feature represents a specific functionality like Email campaign, Deals, Calls, Automations, etc.
*/
export async function main(
auth: Brevo,
body: {
email: string;
all_features_access: false | true;
privileges: {
feature?:
| "email_campaigns"
| "sms_campaigns"
| "contacts"
| "templates"
| "workflows"
| "facebook_ads"
| "landing_pages"
| "transactional_emails"
| "smtp_api"
| "user_management"
| "sales_platform"
| "phone"
| "conversations"
| "senders_domains_dedicated_ips"
| "push_notifications"
| "companies";
permissions?:
| "create_edit_delete"
| "send_schedule_suspend"
| "view"
| "import"
| "export"
| "list_and_attributes"
| "forms"
| "activate_deactivate"
| "activate_deactivate_pause"
| "settings"
| "schedule_pause"
| "all"
| "logs"
| "access"
| "assign"
| "configure"
| "create_edit_deals"
| "delete_deals"
| "manage_others_deals_tasks"
| "manage_owned_companies"
| "manage_others_companies"
| "reports"
| "senders_management"
| "domains_management"
| "dedicated_ips_management"
| "send"
| "smtp"
| "api_keys"
| "authorized_ips"
| "none"[];
}[];
},
) {
const url = new URL(
`https://api.brevo.com/v3/organization/user/invitation/send`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"api-key": auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago