SLACK_ARCHIVE_CHANNEL - Arquivar Canal
O que é esta Tool?
A SLACK_ARCHIVE_CHANNEL é a tool responsável por arquivar canais do Slack que não são mais necessários, mantendo histórico disponível.
Por que esta Tool existe?
Canais inativos poluem workspace. A SLACK_ARCHIVE_CHANNEL existe para:
- Organização: Manter workspace limpo arquivando canais antigos
- Fim de projeto: Arquivar canais quando projetos terminam
- Sprints concluídas: Arquivar canais de sprints passadas
- Incidentes resolvidos: Arquivar canais de incidentes após resolução
- Preservar histórico: Manter conversas acessíveis, mas ocultas
Como funciona internamente?
Quando a SLACK_ARCHIVE_CHANNEL é executada, o sistema:
- Valida o channel ID
- Verifica se já está arquivado
- Arquiva o canal usando endpoint
conversations.archive - Canal some da lista ativa mas histórico permanece
- Se erro: Retorna erro (já arquivado, sem permissão)
- Se sucesso: Confirma arquivamento
Código interno (productivity-executors.service.ts - implementação futura):
async executeSlackArchiveChannel(data: any, variables: Record<string, any>): Promise<any> {
const { botToken, channel } = data;
const archiveUrl = 'https://slack.com/api/conversations.archive';
const response = await axios.post(archiveUrl,
{
channel: channel,
},
{
headers: {
'Authorization': `Bearer ${botToken}`,
'Content-Type': 'application/json',
}
}
);
if (!response.data.ok) {
// Ignorar se já está arquivado
if (response.data.error === 'already_archived') {
return {
success: true,
message: 'Channel already archived',
wasAlreadyArchived: true,
};
}
throw new Error(`Failed to archive channel: ${response.data.error}`);
}
return {
success: true,
channel: channel,
message: 'Channel archived successfully',
};
}
Quando você DEVE usar esta Tool?
Use SLACK_ARCHIVE_CHANNEL sempre que precisar de arquivar canais inativos:
Casos de uso
- Projeto concluído: Arquivar #proj-nome quando projeto finaliza
- Sprint terminada: Arquivar #sprint-15 após sprint review
- Incidente resolvido: Arquivar #incident-database após resolução
- Evento finalizado: Arquivar #evento-workshop após evento
- Cliente desativado: Arquivar canais de clientes inativos
- Limpeza periódica: Arquivar canais sem atividade há 90+ dias
Quando NÃO usar SLACK_ARCHIVE_CHANNEL
- Canal ativo: Não arquive canais com discussões ativas
- Canais permanentes: #geral, #random nunca devem ser arquivados
- Sem consenso: Não arquive sem avisar membros
Parâmetros Detalhados
botToken (string, obrigatório)
O que é: Token de autenticação do Slack Bot.
Permissões necessárias:
- channels:manage - Arquivar canais públicos
- groups:write - Arquivar canais privados
Flow completo para testar:
{
"name": "Teste Arquivar Canal",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "slack_1",
"type": "slack_archive_channel",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Arquivar Canal",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "C01234567"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "✅ Canal arquivado com sucesso!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "slack_1" },
{ "source": "slack_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
channel (string, obrigatório)
O que é: ID do canal a ser arquivado.
Formatos aceitos:
- Channel ID público: C01234567
- Channel ID privado: G01234567
Como obter: 1. Clique com botão direito no canal 2. View channel details 3. Copie o Channel ID
Flow completo para testar:
{
"name": "Arquivar Canal Específico",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Canal a Arquivar",
"parameters": {
"variableName": "canalProjeto",
"value": {
"id": "C01234567",
"nome": "proj-sistema-x",
"motivo": "Projeto concluído"
}
}
}
},
{
"id": "slack_1",
"type": "slack_send_message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Avisar Membros",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "{{canalProjeto.id}}",
"text": "📦 Este canal será arquivado em breve.\n\nMotivo: {{canalProjeto.motivo}}\n\nO histórico permanecerá disponível para consulta."
}
}
},
{
"id": "delay_1",
"type": "delay",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Aguardar 1 hora",
"parameters": {
"duration": 3600
}
}
},
{
"id": "slack_2",
"type": "slack_archive_channel",
"position": { "x": 900, "y": 100 },
"data": {
"label": "Arquivar",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "{{canalProjeto.id}}"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1100, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "slack_1" },
{ "source": "slack_1", "target": "delay_1" },
{ "source": "delay_1", "target": "slack_2" },
{ "source": "slack_2", "target": "end_1" }
]
}
Parâmetros
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| botToken | string | Sim | Token do Bot (channels:manage ou groups:write) |
| channel | string | Sim | ID do canal a arquivar (C01234567 ou G01234567) |
Exemplo 1: Arquivar Projeto Concluído
Objetivo: Quando projeto termina, avisar membros e arquivar canal
JSON para Importar
{
"name": "Projeto Concluído - Arquivar",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Dados Projeto",
"parameters": {
"variableName": "projeto",
"value": {
"nome": "Sistema CRM",
"canal": "C_PROJ_CRM",
"dataFim": "2025-01-15",
"status": "Concluído com sucesso"
}
}
}
},
{
"id": "slack_1",
"type": "slack_send_message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Mensagem Final",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "{{projeto.canal}}",
"text": "🎉 *Projeto {{projeto.nome}} Concluído!*\n\n✅ Status: {{projeto.status}}\n📅 Data: {{projeto.dataFim}}\n\n📦 Este canal será arquivado automaticamente.\nObrigado a todos pelo excelente trabalho! 🚀\n\n_Histórico permanecerá disponível para consulta._"
}
}
},
{
"id": "delay_1",
"type": "delay",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Aguardar 24h",
"parameters": {
"duration": 86400
}
}
},
{
"id": "slack_2",
"type": "slack_archive_channel",
"position": { "x": 900, "y": 100 },
"data": {
"label": "Arquivar Canal",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "{{projeto.canal}}"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1100, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "slack_1" },
{ "source": "slack_1", "target": "delay_1" },
{ "source": "delay_1", "target": "slack_2" },
{ "source": "slack_2", "target": "end_1" }
]
}
Resultado:
Dia 1: Mensagem de conclusão enviada
Dia 2: Canal arquivado automaticamente
Exemplo 2: Limpeza Automática de Sprints
Objetivo: Arquivar canais de sprints antigas automaticamente
JSON para Importar
{
"name": "Arquivar Sprints Antigas",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Sprints para Arquivar",
"parameters": {
"variableName": "sprints",
"value": [
{ "id": "C_SPRINT_10", "numero": 10 },
{ "id": "C_SPRINT_11", "numero": 11 },
{ "id": "C_SPRINT_12", "numero": 12 }
]
}
}
},
{
"id": "slack_1",
"type": "slack_archive_channel",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Arquivar Sprint 10",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "C_SPRINT_10"
}
}
},
{
"id": "slack_2",
"type": "slack_archive_channel",
"position": { "x": 500, "y": 200 },
"data": {
"label": "Arquivar Sprint 11",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "C_SPRINT_11"
}
}
},
{
"id": "slack_3",
"type": "slack_archive_channel",
"position": { "x": 500, "y": 300 },
"data": {
"label": "Arquivar Sprint 12",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "C_SPRINT_12"
}
}
},
{
"id": "slack_4",
"type": "slack_send_message",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Notificar no #geral",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "geral",
"text": "🧹 Limpeza automática concluída!\n\nCanais arquivados:\n• #sprint-10\n• #sprint-11\n• #sprint-12\n\nHistóricos permanecem disponíveis."
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "slack_1" },
{ "source": "variable_1", "target": "slack_2" },
{ "source": "variable_1", "target": "slack_3" },
{ "source": "slack_1", "target": "slack_4" },
{ "source": "slack_2", "target": "slack_4" },
{ "source": "slack_3", "target": "slack_4" },
{ "source": "slack_4", "target": "end_1" }
]
}
Exemplo 3: Arquivar Incidente Resolvido
Objetivo: Após resolver incidente, documentar e arquivar
JSON para Importar
{
"name": "Incidente Resolvido - Arquivar",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Dados Incidente",
"parameters": {
"variableName": "incidente",
"value": {
"id": "INC-20250115-001",
"canal": "C_INCIDENT_001",
"titulo": "Database Connection Timeout",
"resolucao": "Aumentado pool de conexões",
"tempo": "2 horas"
}
}
}
},
{
"id": "slack_1",
"type": "slack_send_message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Resumo Final",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "{{incidente.canal}}",
"text": "✅ *Incidente Resolvido*\n\n🆔 ID: {{incidente.id}}\n📋 Problema: {{incidente.titulo}}\n🔧 Resolução: {{incidente.resolucao}}\n⏱️ Tempo: {{incidente.tempo}}\n\n📦 Este canal será arquivado.\n\n_Post-mortem disponível em: <link>_"
}
}
},
{
"id": "slack_2",
"type": "slack_archive_channel",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Arquivar Canal",
"parameters": {
"botToken": "xoxb-seu-token-aqui",
"channel": "{{incidente.canal}}"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "slack_1" },
{ "source": "slack_1", "target": "slack_2" },
{ "source": "slack_2", "target": "end_1" }
]
}
Resposta da Tool
{
"success": true,
"channel": "C01234567",
"message": "Channel archived successfully"
}
O que acontece quando arquivado?
✅ Mantém: - Todo histórico de mensagens - Arquivos compartilhados - Links e pins - Acessível via busca
❌ Remove: - Da lista de canais ativos - Não pode postar novas mensagens - Não recebe notificações
Desarquivar Canal
Para desarquivar (unarchive), use:
POST /conversations.unarchive
{
"channel": "C01234567"
}
Boas Práticas
✅ SIM:
- Avisar membros antes de arquivar
- Enviar mensagem final com resumo
- Dar tempo para membros salvarem informações (24-48h)
- Documentar motivo do arquivamento
- Arquivar regularmente (limpeza trimestral)
- Manter naming convention para fácil identificação
❌ NÃO:
- Não arquive canais ativos
- Não arquive sem avisar
- Não arquive #geral, #random, canais permanentes
- Não arquive canais com discussões pendentes
Dicas
💡 Timing: Envie mensagem → aguarde 24-48h → arquive
💡 Mensagem final: Sempre explique por que está arquivando
💡 Documentação: Inclua links para post-mortems, wikis, etc.
💡 Batch: Para múltiplos canais, arquive em sequência
💡 Reversível: Canais podem ser desarquivados se necessário
Erros Comuns
already_archived
Causa: Canal já está arquivado Solução: Ignore este erro (objetivo já alcançado)
channel_not_found
Causa: Channel ID inválido Solução: Verifique o Channel ID
cant_archive_general
Causa: Tentando arquivar #geral Solução: Canal #geral não pode ser arquivado
restricted_action
Causa: Bot sem permissão
Solução: Adicione scope channels:manage ou groups:write
not_in_channel
Causa: Bot não é membro do canal Solução: Adicione bot ao canal antes de arquivar
Política de Limpeza Recomendada
Arquivar após: - ✅ 30 dias sem atividade (canais temporários) - ✅ 90 dias sem atividade (canais de projeto) - ✅ Projeto/evento concluído - ✅ Sprint finalizada (após 2 semanas) - ✅ Incidente resolvido (após documentação)
Próxima Tool
→ SLACK_CREATE_CHANNEL - Criar canal → SLACK_SET_TOPIC - Definir tópico → SLACK_SEND_MESSAGE - Enviar mensagem