ZapGPT
Assistente de uso geral em português com DeepSeek Reasoner e 8 ferramentas de ações diretas: busca na web, busca de imagens + envio, links temporários de mídia com Mediagator, busca de notícias GDELT + extração de conteúdo, memória persistente de comportamentos por contato e limpeza de memória da conversa.
Baixar ZIP · 6.2 KB
Configuração obrigatória
Crie estas variáveis de configuração da empresa antes de importar ou executar as ferramentas. Os valores de URL base não devem terminar com barra.
| Variável | Valor |
|---|---|
ZapGPT_SEARCH_BASE_URL | URL base compatível com SearXNG, por exemplo https://<your-search-service> |
ZapGPT_GDELT_BASE_URL | URL base do proxy GDELT, por exemplo https://<your-gdelt-proxy> |
ZapGPT_MEDIAGATOR_BASE_URL | URL do endpoint do Mediagator, por exemplo https://<your-mediagator-service> |
ZapGPT_MEDIAGATOR_API_KEY | Chave de API do Mediagator |
JSON Completo
Clique para expandir
{
"description": "General-purpose Portuguese DeepSeek Reasoner assistant with 8 direct tools: web search, image search + send, Mediagator temporary media links, GDELT news search + content extraction, persistent per-contact behavior memory, and conversation memory clearing.",
"tags": [
"agent",
"llm",
"deepseek",
"web-search",
"images",
"media-download",
"news",
"portuguese",
"tools",
"error-handling",
"searxng",
"gdelt",
"mediagator",
"direct-actions",
"config-variables"
],
"linkedExamples": [],
"document": {
"name": "ZapGPT",
"assistantType": "llm",
"platformType": "deepseek",
"platform": {
"openAi": {
"model": "deepseek-v4-flash",
"apiMode": "chat_completions",
"temperature": 1,
"enableAgentLoop": false,
"agentLoopMaxIterations": 15,
"maxCharsPerMessage": 1024,
"enableByok": false,
"enableStructuredOutputs": false,
"enableContextTokenBudget": false,
"enableImageProcessing": false,
"imageProcessingQuality": "auto",
"preActions": [],
"systemRoleMessages": [
{
"expr": "\"Voce e o ZapGPT, assistente virtual construido na plataforma AutoTalk (https://autotalk.io). Voce esta conversando com \" + contact.name + \". Agora sao \" + format_datetime(now(), \"DD/MM/YYYY HH:mm\", \"America/Sao_Paulo\") + \" em America/Sao_Paulo. Responda no idioma do usuario. Seja direto por padrao, mas seja transparente quando usar ferramentas: avise antes de trabalhos demorados e explique claramente o resultado ou a falha.\"",
"onFailure": "keep",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
{
"expr": "present(trim(coalesce(get(contact.customAttributes, \"zapgptBehaviors\", \"\"), \"\"))) ? \"Comportamentos persistentes definidos por \" + contact.name + \" em contact.customAttributes.zapgptBehaviors: \" + trim(coalesce(get(contact.customAttributes, \"zapgptBehaviors\", \"\"), \"\")) + \". Siga essas preferencias nas respostas futuras, exceto se entrarem em conflito com instrucoes de prioridade maior.\" : \"\"",
"onFailure": "keep",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
{
"expr": "\"Quando a ferramenta busca_imagem retornar opcoes relevantes e o usuario quiser receber uma imagem, escolha uma URL retornada por ela e chame enviar_imagem_url. Para videos ou audio, use baixar_midia apenas quando o usuario pedir para baixar, converter ou extrair midia de uma URL. Nunca invente URLs de imagem, video, audio ou download.\"",
"onFailure": "keep",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
{
"expr": "\"Politica de ferramentas do ZapGPT: use faz_busca para fatos atuais, precos, links, informacoes recentes ou quando nao tiver certeza. Use buscar_noticias_gdelt para noticias e obter_conteudo_noticia_gdelt antes de resumir uma URL/artigo especifico. Depois que uma ferramenta retornar dados, responda com base nesses dados e evite novas chamadas na resposta final, exceto quando a tarefa exigir claramente outra ferramenta. Evite mensagens intermediarias repetidas: em uma mesma solicitacao, envie no maximo uma mensagem curta de progresso antes das ferramentas; se precisar chamar varias ferramentas, aguarde os resultados e responda uma unica vez com a sintese. Se uma ferramenta falhar, diga o que falhou, se vale tentar novamente, e use link temporario quando estiver disponivel. Nunca exponha chaves, tokens, payloads internos, IDs internos ou stack traces.\"",
"onFailure": "keep",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
],
"actions": [],
"toolChoiceType": "auto",
"tools": [
{
"type": "function",
"function": {
"name": "definir_comportamentos_zapgpt",
"description": "Salva comportamentos persistentes do ZapGPT para este contato em contact.customAttributes.zapgptBehaviors. Use quando o usuario pedir para o assistente agir de um jeito especifico daqui para frente. Passe string vazia para limpar.",
"hidden": false,
"isZodTool": false,
"parameters": [
{
"name": "behaviors",
"type": "string",
"description": "Instrucao persistente de comportamento para este contato. Passe string vazia para remover.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": true,
"objectProperties": []
}
],
"actions": [
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/data/company/resource/advanced/update_with_filter",
"actions/data/company/resource/advanced/update_with_filter": {
"dynadataItemType": "contacts",
"filter": {
"expr": "{\"_id\": contact._id}",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"payload": {
"expr": "{\"customAttributes.zapgptBehaviors\": present(behaviors) ? trim(behaviors) : \"\"}",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"upsert": false
}
}
}
],
"output": {
"main": {
"expr": "present(trim(behaviors)) ? \"Comportamentos do ZapGPT salvos para este cliente\" : \"Comportamentos do ZapGPT removidos para este cliente\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"execute_extra_completion": true,
"enable_tools_in_extra_completion": false
}
}
},
{
"type": "function",
"function": {
"name": "faz_busca",
"description": "Busca na internet com SearXNG e retorna resultados, sugestoes e infoboxes. Use para fatos atuais, links, precos, referencias e temas que podem ter mudado recentemente.",
"hidden": false,
"isZodTool": false,
"parameters": [
{
"name": "query",
"type": "string",
"description": "Consulta da busca na internet.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": true,
"objectProperties": []
},
{
"name": "categories",
"type": "string",
"description": "Categorias opcionais do SearXNG, como general, news, images ou general,news.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "language",
"type": "string",
"description": "Codigo de idioma opcional, como pt-BR ou en-US.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "time_range",
"type": "string",
"description": "Filtro temporal opcional: day, month ou year.",
"enableEnums": true,
"defineAsCel": false,
"enumValues": [
"day",
"month",
"year"
],
"isRequired": false,
"objectProperties": []
},
{
"name": "pageno",
"type": "string",
"description": "Pagina opcional dos resultados.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
}
],
"actions": [
{
"condition": {
"expr": "false",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"Estou buscando na internet. Ja volto com as fontes principais.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/config/variables/resolve",
"actions/config/variables/resolve": {
"entries": [
{
"variableName": "ZapGPT_SEARCH_BASE_URL"
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(ZapGPT_SEARCH_BASE_URL + \"/search\", {\"q\": query, \"format\": \"json\", \"categories\": categories, \"language\": language, \"time_range\": time_range, \"pageno\": pageno})",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [
{
"key": {
"expr": "\"Accept\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"isSecret": false,
"value": {
"expr": "\"application/json\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "!step_ok(2)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "coalesce(get(step_error(2), \"user_message\"), \"Nao consegui concluir a busca agora.\") + (coalesce(get(step_error(2), \"retryable\", false)) ? \" Voce pode tentar novamente em instantes.\" : \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"output": {
"main": {
"expr": "toon_encode(step_ok(2) ? {\n \"ok\": true,\n \"query\": step_data(2, \"query\", query),\n \"number_of_results\": step_data(2, \"number_of_results\", 0),\n \"results\": step_data(2, \"results\", []),\n \"suggestions\": step_data(2, \"suggestions\", []),\n \"infoboxes\": step_data(2, \"infoboxes\", []),\n \"error\": null\n} : {\n \"ok\": false,\n \"query\": query,\n \"status\": get(step(2), \"status\"),\n \"data\": step_data(2),\n \"error\": defaults(step_error(2), {\n \"code\": get(step(2), \"status\") != null ? \"http_request_failed\" : \"workflow_step_failed\",\n \"user_message\": coalesce(step_data(2, \"error\"), step_data(2, \"message\"), \"Nao foi possivel concluir a busca na internet.\"),\n \"retryable\": false\n })\n})",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"execute_extra_completion": true,
"enable_tools_in_extra_completion": false
}
}
},
{
"type": "function",
"function": {
"name": "busca_imagem",
"description": "Busca varias imagens na internet e retorna URLs e metadados. Se precisar enviar uma delas na conversa, use a ferramenta enviar_imagem_url com uma URL retornada por esta busca.",
"hidden": false,
"isZodTool": false,
"parameters": [
{
"name": "query",
"type": "string",
"description": "Query da imagem a ser buscada",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": true,
"objectProperties": []
},
{
"name": "language",
"type": "string",
"description": "Codigo de idioma opcional, como pt-BR ou en-US.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "limit",
"type": "number",
"description": "Quantidade opcional de imagens para retornar. Padrao 10, com limite maximo de 25.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "pageno",
"type": "string",
"description": "Pagina opcional dos resultados.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
}
],
"actions": [
{
"condition": {
"expr": "false",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"Estou procurando imagens relevantes. Ja volto com as opcoes.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/config/variables/resolve",
"actions/config/variables/resolve": {
"entries": [
{
"variableName": "ZapGPT_SEARCH_BASE_URL"
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(ZapGPT_SEARCH_BASE_URL + \"/search\", {\"q\": query, \"categories\": \"images\", \"format\": \"json\", \"language\": language, \"pageno\": pageno})",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [
{
"key": {
"expr": "\"Accept\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"isSecret": false,
"value": {
"expr": "\"application/json\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
],
"returnBuffer": false,
"cache": false
}
}
}
],
"output": {
"main": {
"expr": "toon_encode(step_ok(2) ? {\"ok\": true, \"query\": step_data(2, \"query\", query), \"search_status\": get(step(2), \"status\"), \"limit_requested\": coalesce(limit, 10), \"limit_applied\": math_clamp(coalesce(limit, 10), 1, 25), \"total_results\": step_data(2, \"number_of_results\", size(step_data(2, \"results\", []))), \"number_of_results\": size(slice(step_data(2, \"results\", []), 0, math_clamp(coalesce(limit, 10), 1, 25))), \"images\": slice(step_data(2, \"results\", []), 0, math_clamp(coalesce(limit, 10), 1, 25)), \"suggestions\": step_data(2, \"suggestions\", []), \"error\": null} : {\"ok\": false, \"query\": query, \"status\": get(step(2), \"status\"), \"data\": step_data(2), \"error\": defaults(step_error(2), {\"code\": get(step(2), \"status\") != null ? \"image_search_request_failed\" : \"workflow_step_failed\", \"user_message\": coalesce(step_data(2, \"error\"), step_data(2, \"message\"), \"Nao foi possivel consultar imagens agora.\"), \"retryable\": false})})",
"onFailure": "throw",
"fallback": "{}",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"execute_extra_completion": true,
"enable_tools_in_extra_completion": true
}
}
},
{
"type": "function",
"function": {
"name": "enviar_imagem_url",
"description": "Baixa e envia na conversa uma imagem a partir de uma URL direta. Use preferencialmente uma URL retornada pela ferramenta busca_imagem.",
"hidden": false,
"isZodTool": false,
"parameters": [
{
"name": "url",
"type": "string",
"description": "URL direta da imagem a ser enviada.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": true,
"objectProperties": []
},
{
"name": "caption",
"type": "string",
"description": "Legenda opcional para acompanhar a imagem.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "file_name",
"type": "string",
"description": "Nome de arquivo opcional para salvar a imagem baixada.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
}
],
"actions": [
{
"condition": {
"expr": "false",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"Vou baixar e enviar a imagem escolhida.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/download-to-storage",
"actions/network/http/download-to-storage": {
"url": {
"expr": "url",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [],
"fileName": {
"expr": "present(file_name) ? trim(file_name) : null",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"category": "images",
"isPublic": false,
"purpose": "action_response_media"
}
}
},
{
"condition": {
"expr": "get(step(1), \"file\") != null",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "image",
"payload": {
"use_file_expression": true,
"fileExpression": {
"expr": "get(step(1), \"file\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"text": {
"expr": "present(caption) ? trim(caption) : \"\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "get(step(1), \"file\") == null || get(step(2), \"executionContext.status\") == \"failed\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "get(step(1), \"file\") != null && get(step(2), \"executionContext.status\") == \"failed\" ? (\"Consegui baixar a imagem, mas nao consegui enviar diretamente aqui.\" + (present(get(step(1), \"signedUrl\")) ? \" Link temporario: \" + get(step(1), \"signedUrl\") : \" Tente novamente em instantes.\")) : (coalesce(get(step_error(1), \"user_message\"), \"Nao consegui enviar a imagem dessa URL.\") + (coalesce(get(step_error(1), \"retryable\", false)) ? \" Voce pode tentar novamente em instantes.\" : \"\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"output": {
"main": {
"expr": "get(step(1), \"file\") != null && get(step(2), \"executionContext.status\") != \"failed\" ? \"Imagem enviada\" : (get(step(1), \"file\") != null ? \"Imagem baixada e salva, mas o envio direto falhou. Link temporario enviado quando disponivel.\" : coalesce(get(step(2), \"executionContext.safeError.userMessage\"), get(step_error(1), \"user_message\"), \"Nao consegui enviar a imagem dessa URL.\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"execute_extra_completion": false,
"enable_tools_in_extra_completion": false
}
}
},
{
"type": "function",
"function": {
"name": "baixar_midia",
"description": "Baixa um video ou extrai audio de uma URL suportada pelo Mediagator, como YouTube, Instagram, TikTok, X/Twitter, Facebook, Vimeo, Reddit, SoundCloud e outros, e retorna um link temporario para download. Use quando o usuario pedir para baixar, converter ou extrair midia de uma URL.",
"hidden": false,
"isZodTool": false,
"parameters": [
{
"name": "url",
"type": "string",
"description": "URL suportada pelo Mediagator para baixar video ou audio, como YouTube, Instagram, TikTok, X/Twitter, Facebook, Vimeo, Reddit, SoundCloud e outros.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": true,
"objectProperties": []
},
{
"name": "media_type",
"type": "string",
"description": "Tipo de midia: video ou audio. Padrao video.",
"enableEnums": true,
"defineAsCel": false,
"enumValues": [
"video",
"audio"
],
"isRequired": false,
"objectProperties": []
},
{
"name": "quality",
"type": "string",
"description": "Qualidade do video, como 720 ou 1080. Ignorada para audio.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "audio_format",
"type": "string",
"description": "Formato do audio quando media_type for audio. Padrao mp3.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "caption",
"type": "string",
"description": "Legenda opcional para acompanhar a midia enviada.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
}
],
"actions": [
{
"condition": {
"expr": "false",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "(present(media_type) && trim(media_type) == \"audio\") ? \"Vou extrair o audio agora. Isso pode levar alguns instantes; aviso quando terminar.\" : \"Vou baixar o video agora. Isso pode levar alguns instantes; aviso quando terminar.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/config/variables/resolve",
"actions/config/variables/resolve": {
"entries": [
{
"variableName": "ZapGPT_MEDIAGATOR_BASE_URL"
},
{
"variableName": "ZapGPT_MEDIAGATOR_API_KEY"
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "POST",
"url": {
"expr": "ZapGPT_MEDIAGATOR_BASE_URL",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [
{
"key": {
"expr": "\"Accept\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"value": {
"expr": "\"application/json\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
},
{
"key": {
"expr": "\"Content-Type\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"value": {
"expr": "\"application/json\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
},
{
"key": {
"expr": "\"Authorization\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"value": {
"expr": "\"Api-Key \" + ZapGPT_MEDIAGATOR_API_KEY",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
],
"body": {
"expr": "(present(media_type) ? trim(media_type) : \"video\") == \"audio\" ? json_stringify({\"url\": url, \"format\": \"audio\", \"audio_format\": present(audio_format) ? trim(audio_format) : \"mp3\"}) : (present(quality) ? json_stringify({\"url\": url, \"quality\": trim(quality)}) : json_stringify({\"url\": url}))",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "get(step(2), \"status\") == 200 && present(step_data(2, \"download_url\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"Mediagator gerou um link temporario para a midia.\" + (present(step_data(2, \"filename\")) ? \"\\nArquivo: \" + step_data(2, \"filename\") : \"\") + \"\\nLink temporario: \" + step_data(2, \"download_url\") + (present(caption) ? \"\\nLegenda: \" + trim(caption) : \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "get(step(2), \"executionContext.status\") == \"failed\" || get(step(2), \"status\", 0) != 200 || !present(step_data(2, \"download_url\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "get(step(2), \"executionContext.status\") == \"failed\" ? coalesce(get(step_error(2), \"user_message\"), \"Nao consegui baixar a midia agora.\") : (get(step(2), \"status\", 0) != 200 ? coalesce(step_data(2, \"error\"), step_data(2, \"message\"), \"Nao consegui baixar a midia agora.\") : \"A origem nao disponibilizou um link de download para essa midia.\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"output": {
"main": {
"expr": "get(step(2), \"status\") == 200 && present(step_data(2, \"download_url\")) ? (\"Link temporario gerado: \" + step_data(2, \"download_url\") + (present(step_data(2, \"filename\")) ? \" (\" + step_data(2, \"filename\") + \")\" : \"\")) : (get(step(2), \"executionContext.status\") == \"failed\" ? coalesce(get(step_error(2), \"user_message\"), \"Nao consegui baixar a midia agora.\") : (get(step(2), \"status\", 0) != 200 ? coalesce(step_data(2, \"error\"), step_data(2, \"message\"), \"Nao consegui baixar a midia agora.\") : \"A origem nao disponibilizou um link de download para essa midia.\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"execute_extra_completion": false,
"enable_tools_in_extra_completion": false
}
}
},
{
"type": "function",
"function": {
"name": "buscar_noticias_gdelt",
"description": "Busca noticias no GDELT e retorna artigos ou timeline conforme o modo informado.",
"hidden": false,
"isZodTool": false,
"parameters": [
{
"name": "query",
"type": "string",
"description": "Consulta principal para buscar noticias.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": true,
"objectProperties": []
},
{
"name": "mode",
"type": "string",
"description": "Modo do GDELT DOC: ArtList, TimelineVol ou TimelineTone.",
"enableEnums": true,
"defineAsCel": false,
"enumValues": [
"ArtList",
"TimelineVol",
"TimelineTone"
],
"isRequired": false,
"objectProperties": []
},
{
"name": "timespan",
"type": "string",
"description": "Janela relativa como 15min, 3h, 7d, 2w ou 1m.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "startdatetime",
"type": "string",
"description": "Data inicial absoluta no formato YYYYMMDDHHMMSS.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "enddatetime",
"type": "string",
"description": "Data final absoluta no formato YYYYMMDDHHMMSS.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "maxrecords",
"type": "string",
"description": "Quantidade maxima de resultados a solicitar.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "sort",
"type": "string",
"description": "Ordenacao dos resultados.",
"enableEnums": true,
"defineAsCel": false,
"enumValues": [
"datedesc",
"dateasc",
"tonedesc",
"toneasc"
],
"isRequired": false,
"objectProperties": []
},
{
"name": "domain",
"type": "string",
"description": "Dominio da fonte, como reuters.com.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "theme",
"type": "string",
"description": "Tema GDELT para filtrar resultados.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "sourcelang",
"type": "string",
"description": "Idioma da fonte para compatibilidade com o endpoint DOC.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
},
{
"name": "sourcecountry",
"type": "string",
"description": "Pais da fonte para compatibilidade com o endpoint DOC.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": false,
"objectProperties": []
}
],
"actions": [
{
"condition": {
"expr": "false",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"Estou buscando noticias recentes. Ja volto com os resultados.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/config/variables/resolve",
"actions/config/variables/resolve": {
"entries": [
{
"variableName": "ZapGPT_GDELT_BASE_URL"
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(ZapGPT_GDELT_BASE_URL + \"/doc\", {\"query\": query, \"format\": \"json\", \"mode\": present(mode) ? trim(mode) : \"ArtList\", \"timespan\": timespan, \"startdatetime\": startdatetime, \"enddatetime\": enddatetime, \"maxrecords\": maxrecords, \"sort\": sort, \"domain\": domain, \"theme\": theme, \"sourcelang\": sourcelang, \"sourcecountry\": sourcecountry})",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [
{
"key": {
"expr": "\"Accept\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"isSecret": false,
"value": {
"expr": "\"application/json\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "!step_ok(2)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "coalesce(get(step_error(2), \"user_message\"), \"Nao consegui buscar noticias agora.\") + (coalesce(get(step_error(2), \"retryable\", false)) ? \" Voce pode tentar novamente em instantes.\" : \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"output": {
"main": {
"expr": "toon_encode(step_ok(2) ? {\n \"ok\": true,\n \"query\": query,\n \"mode\": present(mode) ? trim(mode) : \"ArtList\",\n \"request\": {\n \"timespan\": timespan,\n \"startdatetime\": startdatetime,\n \"enddatetime\": enddatetime,\n \"maxrecords\": maxrecords,\n \"sort\": sort,\n \"domain\": domain,\n \"theme\": theme,\n \"sourcelang\": sourcelang,\n \"sourcecountry\": sourcecountry\n },\n \"article_count\": size(step_data(2, \"articles\", [])),\n \"articles\": step_data(2, \"articles\", []),\n \"timeline\": step_data(2, \"timeline\", []),\n \"data\": step_data(2),\n \"error\": null\n} : {\n \"ok\": false,\n \"query\": query,\n \"mode\": present(mode) ? trim(mode) : \"ArtList\",\n \"status\": get(step(2), \"status\"),\n \"data\": step_data(2),\n \"error\": defaults(step_error(2), {\n \"code\": get(step(2), \"status\") != null ? \"http_request_failed\" : \"workflow_step_failed\",\n \"user_message\": coalesce(step_data(2, \"error\"), step_data(2, \"message\"), \"Nao foi possivel buscar noticias agora.\"),\n \"retryable\": false\n })\n})",
"onFailure": "throw",
"fallback": "{}",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"execute_extra_completion": true,
"enable_tools_in_extra_completion": false
}
}
},
{
"type": "function",
"function": {
"name": "obter_conteudo_noticia_gdelt",
"description": "Baixa e extrai o conteudo completo de uma noticia a partir da URL usando o GDELT.",
"hidden": false,
"isZodTool": false,
"parameters": [
{
"name": "url",
"type": "string",
"description": "URL da noticia a ser extraida.",
"enableEnums": false,
"defineAsCel": false,
"enumValues": [],
"isRequired": true,
"objectProperties": []
}
],
"actions": [
{
"condition": {
"expr": "false",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"Estou abrindo a noticia e extraindo o conteudo completo.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/config/variables/resolve",
"actions/config/variables/resolve": {
"entries": [
{
"variableName": "ZapGPT_GDELT_BASE_URL"
}
]
}
}
},
{
"condition": {
"expr": "true",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(ZapGPT_GDELT_BASE_URL + \"/doc/content\", {\"url\": url})",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [
{
"key": {
"expr": "\"Accept\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"isSecret": false,
"value": {
"expr": "\"application/json\"",
"onFailure": "fallback",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "!step_ok(2)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "coalesce(get(step_error(2), \"user_message\"), \"Nao consegui extrair o conteudo da noticia.\") + (coalesce(get(step_error(2), \"retryable\", false)) ? \" Voce pode tentar novamente em instantes.\" : \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"output": {
"main": {
"expr": "toon_encode(step_ok(2) ? {\n \"ok\": true,\n \"url\": url,\n \"title\": step_data(2, \"title\"),\n \"content\": coalesce(step_data(2, \"content\"), step_data(2, \"text\"), step_data(2, \"full_text\")),\n \"data\": step_data(2),\n \"error\": null\n} : {\n \"ok\": false,\n \"url\": url,\n \"status\": get(step(2), \"status\"),\n \"data\": step_data(2),\n \"error\": defaults(step_error(2), {\n \"code\": get(step(2), \"status\") != null ? \"http_request_failed\" : \"workflow_step_failed\",\n \"user_message\": coalesce(step_data(2, \"error\"), step_data(2, \"message\"), \"Nao foi possivel extrair o conteudo da noticia.\"),\n \"retryable\": false\n })\n})",
"onFailure": "throw",
"fallback": "{}",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"execute_extra_completion": true,
"enable_tools_in_extra_completion": false
}
}
},
{
"type": "function",
"function": {
"name": "limpar_memoria",
"description": "Limpa o histórico da conversa",
"hidden": false,
"isZodTool": false,
"parameters": [],
"actions": [
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/ai/openai/memory/conversation/clear"
}
},
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"Minha memória foi limpa\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"output": {
"main": {
"expr": "get(step(0), \"executionContext.status\") != \"failed\" ? \"Minha memória foi limpa\" : coalesce(get(step(0), \"executionContext.safeError.userMessage\"), \"Não consegui limpar minha memória.\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"execute_extra_completion": false,
"enable_tools_in_extra_completion": false
}
}
}
],
"mcpServers": []
}
},
"options": {
"log_level": "info",
"listenMessagesContaining": []
}
}
}