1 line
10 KiB
JSON
1 line
10 KiB
JSON
{"repo": "chasexcodex/yemen-eco-pack", "files": {"agent/n8n/workflows/twilio-phone-agent-webhook.json": {"59b1656405dcd393b4ff8a53af2544de61524ca9": {"t": 1785745315.9854743, "n": 4607, "h": "b456ebee4e2214df", "c": "{\n \"id\": \"f0d4ff9f-5f42-48bf-a251-7f42d8611c40\",\n \"name\": \"Twilio DeepSeek Phone Agent\",\n \"active\": true,\n \"nodes\": [\n {\n \"parameters\": {\n \"httpMethod\": \"POST\",\n \"path\": \"twilio-voice\",\n \"responseMode\": \"responseNode\",\n \"options\": {}\n },\n \"id\": \"twilio_voice_webhook\",\n \"name\": \"Webhook\",\n \"type\": \"n8n-nodes-base.webhook\",\n \"typeVersion\": 2.1,\n \"position\": [\n 220,\n 300\n ]\n },\n {\n \"parameters\": {\n \"jsCode\": \"const body = $json.body || {};\\nconst speech = (body.SpeechResult || '').trim();\\nconst from = body.From || 'unknown caller';\\nconst system = 'You are a concise phone voice assistant for InterAI. Keep replies short, natural, and easy to understand over the phone. Ask one question at a time.';\\nconst user = speech || 'The caller just connected. Greet them and ask how you can help.';\\nreturn [{ json: { from, speech, messages: [ { role: 'system', content: system }, { role: 'user', content: user } ] } }];\"\n },\n \"id\": \"prepare_phone_prompt\",\n \"name\": \"Prepare Phone Prompt\",\n \"type\": \"n8n-nodes-base.code\",\n \"typeVersion\": 2,\n \"position\": [\n 480,\n 300\n ]\n },\n {\n \"parameters\": {\n \"method\": \"POST\",\n \"url\": \"https://api.deepseek.com/chat/completions\",\n \"sendHeaders\": true,\n \"headerParameters\": {\n \"parameters\": [\n {\n \"name\": \"Authorization\",\n \"value\": \"=Bearer {{$env.DEEPSEEK_API_KEY}}\"\n },\n {\n \"name\": \"Content-Type\",\n \"value\": \"application/json\"\n }\n ]\n },\n \"sendBody\": true,\n \"specifyBody\": \"json\",\n \"jsonBody\": \"={{ { \\\"model\\\": $env.DEEPSEEK_MODEL || \\\"deepseek-chat\\\", \\\"messages\\\": $json.messages, \\\"temperature\\\": 0.4 } }}\",\n \"options\": {}\n },\n \"id\": \"deepseek_phone_reply\",\n \"name\": \"DeepSeek Phone Reply\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"typeVersion\": 4.2,\n \"position\": [\n 740,\n 300\n ]\n },\n {\n \"parameters\": {\n \"jsCode\": \"const raw = $json.choices?.[0]?.message?.content || 'I am sorry, I did not catch that. How can I help?';\\nconst say = String(raw).replace(/[<>&]/g, (c) => ({ '<': '<', '>': '>', '&': '&' }[c])).slice(0, 1200);\\nconst action = ($env.WEBHOOK_URL || 'https://ai.elyasamri.com') + '/webhook/f0d4ff9f-5f42-48bf-a251-7f42d8611c40/webhook/twilio-voice';\\nconst twiml = '<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\\\n' +\\n '<Response>\\\\n' +\\n ' <Say voice=\\\"alice\\\">' + say + '</Say>\\\\n' +\\n ' <Gather input=\\\"speech\\\" action=\\\"' + action + '\\\" method=\\\"POST\\\" speechTimeout=\\\"auto\\\" timeout=\\\"6\\\">\\\\n' +\\n ' <Say voice=\\\"alice\\\">You can reply after the beep.</Say>\\\\n' +\\n ' </Gather>\\\\n' +\\n ' <Say voice=\\\"alice\\\">Goodbye.</Say>\\\\n' +\\n '</Response>';\\nreturn [{ json: { twiml } }];\"\n },\n \"id\": \"compose_twiml\",\n \"name\": \"Compose TwiML\",\n \"type\": \"n8n-nodes-base.code\",\n \"typeVersion\": 2,\n \"position\": [\n 1000,\n 300\n ]\n },\n {\n \"parameters\": {\n \"respondWith\": \"text\",\n \"responseBody\": \"={{$json.twiml}}\",\n \"options\": {\n \"responseHeaders\": {\n \"entries\": [\n {\n \"name\": \"Content-Type\",\n \"value\": \"text/xml\"\n }\n ]\n }\n }\n },\n \"id\": \"respond_twiml\",\n \"name\": \"Respond TwiML\",\n \"type\": \"n8n-nodes-base.respondToWebhook\",\n \"typeVersion\": 1.1,\n \"position\": [\n 1260,\n 300\n ]\n }\n ],\n \"connections\": {\n \"Prepare Phone Prompt\": {\n \"main\": [\n [\n {\n \"node\": \"DeepSeek Phone Reply\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"DeepSeek Phone Reply\": {\n \"main\": [\n [\n {\n \"node\": \"Compose TwiML\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Compose TwiML\": {\n \"main\": [\n [\n {\n \"node\": \"Respond TwiML\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Webhook\": {\n \"main\": [\n [\n {\n \"node\": \"Prepare Phone Prompt\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n },\n \"settings\": {},\n \"staticData\": null,\n \"meta\": null,\n \"pinData\": {},\n \"versionId\": \"9b5da8d8-f786-45c4-9258-e295072197a5\"\n}\n"}, "71cf68f5b1ff1d2017cbd40a1a2fe9e6563de0f2": {"t": 1785749979.7447293, "n": 4607, "h": "b456ebee4e2214df", "c": "{\n \"id\": \"f0d4ff9f-5f42-48bf-a251-7f42d8611c40\",\n \"name\": \"Twilio DeepSeek Phone Agent\",\n \"active\": true,\n \"nodes\": [\n {\n \"parameters\": {\n \"httpMethod\": \"POST\",\n \"path\": \"twilio-voice\",\n \"responseMode\": \"responseNode\",\n \"options\": {}\n },\n \"id\": \"twilio_voice_webhook\",\n \"name\": \"Webhook\",\n \"type\": \"n8n-nodes-base.webhook\",\n \"typeVersion\": 2.1,\n \"position\": [\n 220,\n 300\n ]\n },\n {\n \"parameters\": {\n \"jsCode\": \"const body = $json.body || {};\\nconst speech = (body.SpeechResult || '').trim();\\nconst from = body.From || 'unknown caller';\\nconst system = 'You are a concise phone voice assistant for InterAI. Keep replies short, natural, and easy to understand over the phone. Ask one question at a time.';\\nconst user = speech || 'The caller just connected. Greet them and ask how you can help.';\\nreturn [{ json: { from, speech, messages: [ { role: 'system', content: system }, { role: 'user', content: user } ] } }];\"\n },\n \"id\": \"prepare_phone_prompt\",\n \"name\": \"Prepare Phone Prompt\",\n \"type\": \"n8n-nodes-base.code\",\n \"typeVersion\": 2,\n \"position\": [\n 480,\n 300\n ]\n },\n {\n \"parameters\": {\n \"method\": \"POST\",\n \"url\": \"https://api.deepseek.com/chat/completions\",\n \"sendHeaders\": true,\n \"headerParameters\": {\n \"parameters\": [\n {\n \"name\": \"Authorization\",\n \"value\": \"=Bearer {{$env.DEEPSEEK_API_KEY}}\"\n },\n {\n \"name\": \"Content-Type\",\n \"value\": \"application/json\"\n }\n ]\n },\n \"sendBody\": true,\n \"specifyBody\": \"json\",\n \"jsonBody\": \"={{ { \\\"model\\\": $env.DEEPSEEK_MODEL || \\\"deepseek-chat\\\", \\\"messages\\\": $json.messages, \\\"temperature\\\": 0.4 } }}\",\n \"options\": {}\n },\n \"id\": \"deepseek_phone_reply\",\n \"name\": \"DeepSeek Phone Reply\",\n \"type\": \"n8n-nodes-base.httpRequest\",\n \"typeVersion\": 4.2,\n \"position\": [\n 740,\n 300\n ]\n },\n {\n \"parameters\": {\n \"jsCode\": \"const raw = $json.choices?.[0]?.message?.content || 'I am sorry, I did not catch that. How can I help?';\\nconst say = String(raw).replace(/[<>&]/g, (c) => ({ '<': '<', '>': '>', '&': '&' }[c])).slice(0, 1200);\\nconst action = ($env.WEBHOOK_URL || 'https://ai.elyasamri.com') + '/webhook/f0d4ff9f-5f42-48bf-a251-7f42d8611c40/webhook/twilio-voice';\\nconst twiml = '<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\\\n' +\\n '<Response>\\\\n' +\\n ' <Say voice=\\\"alice\\\">' + say + '</Say>\\\\n' +\\n ' <Gather input=\\\"speech\\\" action=\\\"' + action + '\\\" method=\\\"POST\\\" speechTimeout=\\\"auto\\\" timeout=\\\"6\\\">\\\\n' +\\n ' <Say voice=\\\"alice\\\">You can reply after the beep.</Say>\\\\n' +\\n ' </Gather>\\\\n' +\\n ' <Say voice=\\\"alice\\\">Goodbye.</Say>\\\\n' +\\n '</Response>';\\nreturn [{ json: { twiml } }];\"\n },\n \"id\": \"compose_twiml\",\n \"name\": \"Compose TwiML\",\n \"type\": \"n8n-nodes-base.code\",\n \"typeVersion\": 2,\n \"position\": [\n 1000,\n 300\n ]\n },\n {\n \"parameters\": {\n \"respondWith\": \"text\",\n \"responseBody\": \"={{$json.twiml}}\",\n \"options\": {\n \"responseHeaders\": {\n \"entries\": [\n {\n \"name\": \"Content-Type\",\n \"value\": \"text/xml\"\n }\n ]\n }\n }\n },\n \"id\": \"respond_twiml\",\n \"name\": \"Respond TwiML\",\n \"type\": \"n8n-nodes-base.respondToWebhook\",\n \"typeVersion\": 1.1,\n \"position\": [\n 1260,\n 300\n ]\n }\n ],\n \"connections\": {\n \"Prepare Phone Prompt\": {\n \"main\": [\n [\n {\n \"node\": \"DeepSeek Phone Reply\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"DeepSeek Phone Reply\": {\n \"main\": [\n [\n {\n \"node\": \"Compose TwiML\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Compose TwiML\": {\n \"main\": [\n [\n {\n \"node\": \"Respond TwiML\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n },\n \"Webhook\": {\n \"main\": [\n [\n {\n \"node\": \"Prepare Phone Prompt\",\n \"type\": \"main\",\n \"index\": 0\n }\n ]\n ]\n }\n },\n \"settings\": {},\n \"staticData\": null,\n \"meta\": null,\n \"pinData\": {},\n \"versionId\": \"9b5da8d8-f786-45c4-9258-e295072197a5\"\n}\n"}}}} |