Description
n8n-nodes-mega
Node de comunidade para n8n para trabalhar com a API do Mega.
Recursos
Meganode regular para APIs do Mega com escopo de contaMega Clientnode regular para APIs Client publicasMega Platformnode regular para APIs Platform do MegaAccount -> GetoperationAccount -> UpdateoperationAgent -> Get Many,Create,Update, andDeleteoperationsAgent Bot -> Get Many,Create,Get,Update, andDeleteoperationsAutomation Rule -> Get Many,Create,Get,Update, andDeleteoperationsAudit Log -> Get ManyoperationCampaign -> CreateoperationCanned Response -> Get Many,Create,Update, andDeleteoperationsCustom Filter -> Get Many,Create,Get,Update, andDeleteoperationsContact -> Get Many,Create,Create Note,Get,Update,Delete,Delete Note,Get Conversations,Search,Filter,Create Inbox,Get Contactable Inboxes, andMergeoperationsConversation -> Get Counts,Get Many,Create,Create and Send Message,Filter,Get,Update,Toggle Status,Toggle Priority,Toggle Typing Status,Set Custom Attributes,Get Labels,Set Labels,Get Reporting Events, andAssignoperationsCustom Attribute -> Get Many,Create,Get,Update, andDeleteoperationsInbox -> Get Many,Get,Create,Update,Get Agent Bot,Set Agent Bot,Get Agents,Add Agent,Remove Agent, andUpdate AgentsoperationsIntegration -> Get Many,Create,Update, andDeleteoperationsMessage -> Get Many,Create, andDeleteoperationsPortal -> Get Many,Create, andUpdateoperationsPortal Category -> CreateoperationPortal Article -> CreateoperationProfile -> GetoperationTeam -> Get Many,Get,Create,Update,Delete,Get Agents,Add Agent,Remove Agent, andUpdate AgentsoperationsWebhook -> Get Many,Create,Update, andDeleteoperationsMega APIcredential withBase URL,API Access Token, andMega Account IDMega Client APIcredential withBase URLandInbox IdentifierMega Platform APIcredential withBase URLandPlatform API Access Token- Teste de conexao da credencial usando
GET /api/v1/profile - Node.js 22+ e necessario para executar os comandos atuais de
buildelintdo@n8n/node-cli - npm
Requisitos
Instalacao
npm install
npm run build
Para usar como community node local durante o desenvolvimento:
npm run dev
Para instalar o pacote publicado no n8n:
npm install @jessefreitas/n8n-nodes-mega
Credenciais
Crie uma credencial Mega API no n8n com:
Base URL: URL da sua instancia Mega, por exemplo https://app.example.comAPI Access Token: token da aplicacao enviado no header apiaccesstokenMega Account ID: identificador externo da conta Mega usado em endpoints com escopo de contaO teste da credencial chama GET /api/v1/profile para validar o token.
API Platform
Use o node Mega Platform com a credencial Mega Platform API para endpoints de Platform App em:
/platform/api/v1/*
Crie uma credencial Mega Platform API no n8n com:
Base URL: URL da sua instancia MegaPlatform API Access Token: token do app platform enviado no header apiaccesstokenO teste da credencial chama:
GET /platform/api/v1/accounts
Recursos suportados em Mega Platform:
Account -> Create, Get, Update, and DeleteAccount User -> Get Many, Create, and DeleteAgent Bot -> Get Many, Create, Get, Update, and DeleteUser -> Create, Get, Update, Delete, and Get SSO LinkImportante:
Mega and Mega Platform nao compartilham credenciaisMega e para APIs de aplicacao com escopo de conta em /api/v1/accounts/*Mega Platform e para APIs Platform em /platform/api/v1/*API Client
Use o node Mega Client com a credencial Mega Client API para endpoints publicos client em:
/public/api/v1/*
Crie uma credencial Mega Client API no n8n com:
Base URL: URL da sua instancia MegaInbox Identifier: identificador publico da caixa de entrada usado pelas APIs ClientRecursos suportados em Mega Client:
Contact -> Create, Get, and UpdateConversation -> Get Many, Create, Get, Resolve, Toggle Typing Status, and Update Last SeenMessage -> Get Many, Create, and UpdateCSAT Survey -> GetImportante:
Mega, Mega Platform, and Mega Client nao compartilham credenciaisMega Client usa identificadores publicos como inboxidentifier, contactidentifier, and conversation_idCSAT Survey usa uma rota publica conversation_uuid fora do padrao /public/api/v1/inboxes/*Operacoes
Account -> Get
Obtem detalhes da conta em:
GET /api/v1/accounts/{accountId}
Account -> Update
Suporta atualizar estes campos:
NameLocaleDomainSupport EmailAuto Resolve AfterAuto Resolve MessageAuto Resolve Ignore WaitingIndustryCompany SizeTimezoneO node envia requisicoes para:
PATCH /api/v1/accounts/{accountId}
Mega Platform Operations
Platform Account
Operacoes suportadas:
CreateGetUpdateDeleteO node envia requisicoes para:
POST /platform/api/v1/accounts
GET /platform/api/v1/accounts/{accountId}
PATCH /platform/api/v1/accounts/{accountId}
DELETE /platform/api/v1/accounts/{accountId}
Campos suportados:
NameLocaleDomainSupport EmailStatusLimitsCustom AttributesPlatform Account User
Operacoes suportadas:
Get ManyCreateDeleteO node envia requisicoes para:
GET /platform/api/v1/accounts/{accountId}/account_users
POST /platform/api/v1/accounts/{accountId}/account_users
DELETE /platform/api/v1/accounts/{accountId}/account_users
Campos suportados:
Account IDUser IDRolePlatform Agent Bot
Operacoes suportadas:
Get ManyCreateGetUpdateDeleteO node envia requisicoes para:
GET /platform/api/v1/agent_bots
POST /platform/api/v1/agent_bots
GET /platform/api/v1/agent_bots/{id}
PATCH /platform/api/v1/agent_bots/{id}
DELETE /platform/api/v1/agent_bots/{id}
Campos suportados:
NameDescriptionOutgoing URLAccount IDAvatar URLThe documented binary avatar upload field is not implemented yet in this node.
Platform User
Operacoes suportadas:
CreateGetUpdateDeleteGet SSO LinkO node envia requisicoes para:
POST /platform/api/v1/users
GET /platform/api/v1/users/{id}
PATCH /platform/api/v1/users/{id}
DELETE /platform/api/v1/users/{id}
GET /platform/api/v1/users/{id}/login
Campos suportados:
NameDisplay NameEmailPasswordCustom AttributesMega Client Operations
Client Contact
Operacoes suportadas:
CreateGetUpdateO node envia requisicoes para:
POST /public/api/v1/inboxes/{inboxIdentifier}/contacts
GET /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}
PATCH /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}
Campos suportados:
Contact IdentifierIdentifierIdentifier HashEmailNamePhone NumberCustom AttributesThe documented binary avatar upload field is not implemented yet in this node.
Client Conversation
Operacoes suportadas:
Get ManyCreateGetResolveToggle Typing StatusUpdate Last SeenO node envia requisicoes para:
GET /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations
POST /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations
GET /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations/{conversationId}
POST /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations/{conversationId}/toggle_status
POST /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations/{conversationId}/toggle_typing
POST /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations/{conversationId}/updatelastseen
Campos suportados:
Contact IdentifierConversation IDCustom AttributesTyping StatusClient Message
Operacoes suportadas:
Get ManyCreateUpdateO node envia requisicoes para:
GET /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations/{conversationId}/messages
POST /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations/{conversationId}/messages
PATCH /public/api/v1/inboxes/{inboxIdentifier}/contacts/{contactIdentifier}/conversations/{conversationId}/messages/{messageId}
Campos suportados:
Contact IdentifierConversation IDMessage IDContentEcho IDSubmitted ValuesClient CSAT Survey
Operacoes suportadas:
GetO node envia requisicoes para:
GET /survey/responses/{conversationUuid}
Campos suportados:
Conversation UUIDAudit Log -> Get Many
Lists audit log entries from:
GET /api/v1/accounts/{accountId}/audit_logs
Available fields:
PageEste endpoint s? est? dispon?vel em edi??es Enterprise do Mega com o recurso de logs de auditoria habilitado.
Agent Bot
Operacoes suportadas:
Get ManyCreateGetUpdateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/agent_bots
POST /api/v1/accounts/{accountId}/agent_bots
GET /api/v1/accounts/{accountId}/agent_bots/{id}
PATCH /api/v1/accounts/{accountId}/agent_bots/{id}
DELETE /api/v1/accounts/{accountId}/agent_bots/{id}
Campos suportados:
NameDescriptionOutgoing URLAvatar URLBot TypeBot ConfigThe documented binary avatar upload field is not implemented yet in this node. Use Avatar URL instead.
Agent
Operacoes suportadas:
Get ManyCreateUpdateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/agents
POST /api/v1/accounts/{accountId}/agents
PATCH /api/v1/accounts/{accountId}/agents/{id}
DELETE /api/v1/accounts/{accountId}/agents/{id}
Campos suportados:
NameEmailRoleAvailability StatusAuto OfflineAutomation Rule
Operacoes suportadas:
Get ManyCreateGetUpdateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/automation_rules
POST /api/v1/accounts/{accountId}/automation_rules
GET /api/v1/accounts/{accountId}/automation_rules/{id}
PATCH /api/v1/accounts/{accountId}/automation_rules/{id}
DELETE /api/v1/accounts/{accountId}/automation_rules/{id}
Campos suportados:
NameDescriptionEvent NameActiveActionsConditionsCampaign
Operacoes suportadas:
CreateO node envia requisicoes para:
POST /api/v1/accounts/{accountId}/campaigns
Campos suportados:
TitleMessageInbox IDScheduled AtTrigger Only During Business HoursTemplate ParamsAudience LabelsThis first implementation covers only campaign creation and models audience as label references in the form { id, type: "Label" }.
Canned Response
Operacoes suportadas:
Get ManyCreateUpdateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/canned_responses
POST /api/v1/accounts/{accountId}/canned_responses
PATCH /api/v1/accounts/{accountId}/canned_responses/{id}
DELETE /api/v1/accounts/{accountId}/canned_responses/{id}
Campos suportados:
Short CodeContentChat Room
Operacoes suportadas:
Get ManyCreateGetUpdateDeleteMark As ReadGet MembersAdd MembersUpdate MembersRemove MembersGet MessagesCreate MessageO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/chat_rooms
POST /api/v1/accounts/{accountId}/chat_rooms
GET /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}
PUT /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}
DELETE /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}
POST /api/v1/accounts/{accountId}/chatrooms/{chatRoomId}/markas_read
GET /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}/members
POST /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}/members
PATCH /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}/members
DELETE /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}/members
GET /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}/messages
POST /api/v1/accounts/{accountId}/chat_rooms/{chatRoomId}/messages
Campos suportados:
Chat Room IDNameDescriptionUser IDsPagePer PageContentMessage TypeEcho IDContent AttributesThis first implementation uses JSON payloads only. Binary avatar uploads for rooms and file attachments for room messages are not implemented yet.
Custom Filter
Operacoes suportadas:
Get ManyCreateGetUpdateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/custom_filters
POST /api/v1/accounts/{accountId}/custom_filters
GET /api/v1/accounts/{accountId}/custom_filters/{customFilterId}
PATCH /api/v1/accounts/{accountId}/custom_filters/{customFilterId}
DELETE /api/v1/accounts/{accountId}/custom_filters/{customFilterId}
Campos suportados:
Filter TypeNameTypeQueryContact
Operacoes suportadas:
Get ManyCreateCreate NoteGetUpdateDeleteDelete NoteGet ConversationsSearchFilterCreate InboxGet Contactable InboxesGet LabelsAdd LabelsRemove LabelsSet LabelsMergeO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/contacts
POST /api/v1/accounts/{accountId}/contacts
GET /api/v1/accounts/{accountId}/contacts/{id}
PUT /api/v1/accounts/{accountId}/contacts/{id}
DELETE /api/v1/accounts/{accountId}/contacts/{id}
GET /api/v1/accounts/{accountId}/contacts/{id}/conversations
GET /api/v1/accounts/{accountId}/contacts/search
POST /api/v1/accounts/{accountId}/contacts/filter
POST /api/v1/accounts/{accountId}/contacts/{id}/contact_inboxes
POST /api/v1/accounts/{accountId}/contacts/{id}/notes
GET /api/v1/accounts/{accountId}/contacts/{id}/contactable_inboxes
GET /api/v1/accounts/{accountId}/contacts/{id}/labels
POST /api/v1/accounts/{accountId}/contacts/{id}/labels
DELETE /api/v1/accounts/{accountId}/contacts/{id}/notes/{noteId}
POST /api/v1/accounts/{accountId}/actions/contact_merge
Campos suportados:
Inbox IDNameEmailBlockedPhone NumberAvatar URLIdentifierAdditional AttributesCustom AttributesPageSortQueryFilter PayloadSource IDLabelsContentNote IDBase Contact IDMergee Contact IDThe documented binary avatar upload field is not implemented yet in this node. Use Avatar URL instead.
Portal
Operacoes suportadas:
Get ManyCreateUpdateO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/portals
POST /api/v1/accounts/{accountId}/portals
PATCH /api/v1/accounts/{accountId}/portals/{id}
Campos suportados:
NameSlugPage TitleHeader TextColorCustom DomainHomepage LinkArchivedConfigPortal Category
Operacoes suportadas:
CreateO node envia requisicoes para:
POST /api/v1/accounts/{accountId}/portals/{id}/categories
Campos suportados:
NameDescriptionPositionSlugLocaleIconParent Category IDAssociated Category IDPortal Article
Operacoes suportadas:
CreateO node envia requisicoes para:
POST /api/v1/accounts/{accountId}/portals/{id}/articles
Campos suportados:
TitleSlugPositionContentDescriptionCategory IDAuthor IDAssociated Article IDStatusLocaleMetaCustom Attribute
Operacoes suportadas:
Get ManyCreateGetUpdateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/customattributedefinitions
POST /api/v1/accounts/{accountId}/customattributedefinitions
GET /api/v1/accounts/{accountId}/customattributedefinitions/{id}
PATCH /api/v1/accounts/{accountId}/customattributedefinitions/{id}
DELETE /api/v1/accounts/{accountId}/customattributedefinitions/{id}
Campos suportados:
Attribute Display NameAttribute Display TypeAttribute DescriptionAttribute KeyAttribute ModelAttribute ValuesRegex PatternRegex CueDefault ValueInbox
Operacoes suportadas:
Get ManyGetCreateUpdateGet Agent BotSet Agent BotGet AgentsAdd AgentRemove AgentUpdate AgentsO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/inboxes
GET /api/v1/accounts/{accountId}/inboxes/{id}
POST /api/v1/accounts/{accountId}/inboxes
PATCH /api/v1/accounts/{accountId}/inboxes/{id}
GET /api/v1/accounts/{accountId}/inboxes/{id}/agent_bot
POST /api/v1/accounts/{accountId}/inboxes/{id}/setagentbot
GET /api/v1/accounts/{accountId}/inbox_members/{inboxId}
POST /api/v1/accounts/{accountId}/inbox_members
DELETE /api/v1/accounts/{accountId}/inbox_members
PATCH /api/v1/accounts/{accountId}/inbox_members
Campos suportados:
NameChannel TypeChannel ConfigGreeting EnabledGreeting MessageEnable Email CollectCSAT Survey EnabledEnable Auto AssignmentWorking Hours EnabledOut of Office MessageTimezoneAllow Messages After ResolvedLock to Single ConversationPortal IDSender Name TypeBusiness NameAgent Bot IDUser IDsThe documented binary avatar upload field is not implemented yet in this node.
Integration
Operacoes suportadas:
Get ManyCreateUpdateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/integrations/hooks
POST /api/v1/accounts/{accountId}/integrations/hooks
PATCH /api/v1/accounts/{accountId}/integrations/hooks/{hookId}
DELETE /api/v1/accounts/{accountId}/integrations/hooks/{hookId}
Campos suportados:
App IDInbox IDStatusSettingsMessage
Operacoes suportadas:
Get ManyCreateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/conversations/{conversationId}/messages
POST /api/v1/accounts/{accountId}/conversations/{conversationId}/messages
DELETE /api/v1/accounts/{accountId}/conversations/{conversationId}/messages/{messageId}
Campos suportados:
Conversation IDAfter Message IDBefore Message IDContentAttachments SourceAttachment Binary PropertiesMessage TypePrivateContent TypeContent AttributesCampaign IDTemplate ParamsMessage -> Create supports optional multipart uploads using n8n binary properties.
Attachment Binary Properties with a JSON array such as ["data", "audio", "pdf"]attachments[] in multipart/form-dataScheduled Message
Operacoes suportadas:
Get ManyGetCreateUpdateDeleteCountThe node supports two scopes:
AccountConversationO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/scheduled_messages
GET /api/v1/accounts/{accountId}/scheduled_messages/{scheduledMessageId}
POST /api/v1/accounts/{accountId}/scheduled_messages
PUT /api/v1/accounts/{accountId}/scheduled_messages/{scheduledMessageId}
DELETE /api/v1/accounts/{accountId}/scheduled_messages/{scheduledMessageId}
GET /api/v1/accounts/{accountId}/conversations/{conversationId}/scheduled_messages
GET /api/v1/accounts/{accountId}/conversations/{conversationId}/scheduled_messages/{scheduledMessageId}
POST /api/v1/accounts/{accountId}/conversations/{conversationId}/scheduled_messages
PUT /api/v1/accounts/{accountId}/conversations/{conversationId}/scheduled_messages/{scheduledMessageId}
DELETE /api/v1/accounts/{accountId}/conversations/{conversationId}/scheduled_messages/{scheduledMessageId}
GET /api/v1/accounts/{accountId}/conversations/{conversationId}/scheduled_messages/count
Campos suportados:
ScopeScheduled Message IDConversation IDInbox IDContact IDContentScheduled AtTitleTemplate ParamsRecurrence TypeRecurrence IntervalRecurrence DaysRecurrence End TypeRecurrence End DateRecurrence Max OccurrencesStatusThis first implementation uses JSON payloads only. Binary attachments for scheduled messages are not implemented yet.
Profile -> Get
Fetches the authenticated user profile from:
GET /api/v1/profile
Team
Operacoes suportadas:
Get ManyGetCreateUpdateDeleteGet AgentsAdd AgentRemove AgentUpdate AgentsO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/teams
GET /api/v1/accounts/{accountId}/teams/{teamId}
POST /api/v1/accounts/{accountId}/teams
PATCH /api/v1/accounts/{accountId}/teams/{teamId}
DELETE /api/v1/accounts/{accountId}/teams/{teamId}
GET /api/v1/accounts/{accountId}/teams/{teamId}/team_members
POST /api/v1/accounts/{accountId}/teams/{teamId}/team_members
DELETE /api/v1/accounts/{accountId}/teams/{teamId}/team_members
PATCH /api/v1/accounts/{accountId}/teams/{teamId}/team_members
Campos suportados:
NameDescriptionAllow Auto AssignUser IDsWebhook
Operacoes suportadas:
Get ManyCreateUpdateDeleteO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/webhooks
POST /api/v1/accounts/{accountId}/webhooks
PATCH /api/v1/accounts/{accountId}/webhooks/{webhookId}
DELETE /api/v1/accounts/{accountId}/webhooks/{webhookId}
Campos suportados:
NameURLSubscriptionsConversation
Operacoes suportadas:
Get CountsGet ManyCreateCreate and Send MessageFilterGetUpdateToggle StatusToggle PriorityToggle Typing StatusSet Custom AttributesGet LabelsSet LabelsGet ParticipantsSet ParticipantsGet Reporting EventsAssignO node envia requisicoes para:
GET /api/v1/accounts/{accountId}/conversations/meta
GET /api/v1/accounts/{accountId}/conversations
POST /api/v1/accounts/{accountId}/conversations
POST /api/v1/accounts/{accountId}/conversations/filter
GET /api/v1/accounts/{accountId}/conversations/{id}
PATCH /api/v1/accounts/{accountId}/conversations/{id}
POST /api/v1/accounts/{accountId}/conversations/{id}/messages
POST /api/v1/accounts/{accountId}/conversations/{id}/toggle_status
POST /api/v1/accounts/{accountId}/conversations/{id}/toggle_priority
POST /api/v1/accounts/{accountId}/conversations/{id}/toggletypingstatus
POST /api/v1/accounts/{accountId}/conversations/{id}/custom_attributes
GET /api/v1/accounts/{accountId}/conversations/{id}/labels
POST /api/v1/accounts/{accountId}/conversations/{id}/labels
GET /api/v1/accounts/{accountId}/conversations/{id}/participants
PATCH /api/v1/accounts/{accountId}/conversations/{id}/participants
GET /api/v1/accounts/{accountId}/conversations/{id}/conversation_events
POST /api/v1/accounts/{accountId}/conversations/{id}/assignments
Campos suportados:
Conversation IDAssignee TypeStatusQueryInbox IDTeam IDLabelsPageFilter PayloadSource IDContact IDAssignee IDInitial MessageMessage ContentMessage VisibilityAttachments SourceAttachment Binary PropertiesAdditional AttributesCustom AttributesPriorityUser IDsSLA Policy IDSnoozed UntilTyping StatusPrivate NoteCreate can send an optional normal first message in the conversation creation request.
Create and Send Message is the combined flow:
Normal sends the message in POST /conversationsPrivate creates the conversation first and then sends a private note in POST /conversations/{id}/messagesWhen attachments are provided in Create and Send Message, the node creates the conversation first and then sends the message in a second request to POST /conversations/{id}/messages, for both Normal and Private.
Attachment Binary Properties with a JSON array such as ["data", "audio", "pdf"]attachments[] in multipart/form-dataThis first version supports one message only and does not expose advanced message payload fields such as contenttype, templateparams, campaignid, or contentattributes.
Validacao local
npm run lint
npm run build
Se voce estiver usando uma versao mais antiga do Node.js, o @n8n/node-cli atual pode falhar durante a validacao local. Use Node.js 22+ antes de publicar ou submeter o pacote para revisao.