https://discord.gg/botpress logo
What's in the execute code block? Censor
# 🌎general
s
What's in the execute code block? Censor anything sensitive
w
just a claude api query
Copy code
const url = 'https://api.anthropic.com/v1/messages';
const headers = {
  'x-api-key': '(api-key)',
  'anthropic-version': '2023-06-01',
  'anthropic-dangerous-direct-browser-access': 'true',
  'Content-Type': 'application/json'
};

const systemPrompt = `
(prompt here)
`
 
const userPrompt = `
# Input Data

Below is the user message:

${user.message}
`

const data = {
  "model": "claude-sonnet-4-20250514",
  "max_tokens": 15000,
  "system": systemPrompt,
  "messages": [
    {
      "role": "user",
      "content": userPrompt
    }
  ],
  "thinking": {
    "type": "enabled",
    "budget_tokens": 8000
  }
};

const response = await axios.post(url, data, { headers });
console.log('Anthropic API Response:', response.data);

const claudeMessage = response.data.content[1]?.text;

workflow.posso_responder = claudeMessage;
2 Views