Segue um template para saudação baseado em períodos do dia.
Salvar arquivo como json e importar no Typebot.
- Amanhã
- Tarde
- Noite
- Madrugada
{ "version": "5", "id": "clnr7unnr0001qi1p151cyf0k", "name": "Saudação", "groups": [ { "id": "gil4ln85tcyfr5n5p3utqbvd", "title": "Start", "graphCoordinates": { "x": -22, "y": 208 }, "blocks": [ { "id": "f1hwzp3exgim7i8j04re4s4l", "groupId": "gil4ln85tcyfr5n5p3utqbvd", "outgoingEdgeId": "i2zi8k5z6awaiwuuepsfnu4g", "type": "start", "label": "Start" } ] }, { "id": "c1saf3c4himwxy8lnh1v49y1", "title": "Script", "graphCoordinates": { "x": 371, "y": 100 }, "blocks": [ { "id": "zvnvff3rmbsh8b3wyb372dzh", "groupId": "c1saf3c4himwxy8lnh1v49y1", "outgoingEdgeId": "ft18i9oqkp6pusm8vsk7r9qs", "type": "Set variable", "options": { "variableId": "vp8od10kng0salkymug9wufam", "expressionToEvaluate": "// Obter a data atual como objeto Date\nlet dataAtual = new Date();\n\n// Configurar o fuso horário\ndataAtual = new Date(dataAtual.toLocaleString('en-US', { timeZone: 'America/Recife' }));\n\n// Obter o horário atual\nlet horaAtual = dataAtual.getHours();\n\n// Determinar a saudação adequada baseada na hora do dia\nlet saudacao;\nif (horaAtual >= 5 && horaAtual < 12) {\n saudacao = \"Bom dia\";\n} else if (horaAtual >= 12 && horaAtual < 18) {\n saudacao = \"Boa tarde\";\n} else if (horaAtual >= 18 && horaAtual <= 23) {\n saudacao = \"Boa noite\";\n} else {\n saudacao = \"Boa madrugada\";\n}\n\n// Exibir a saudação\nreturn saudacao", "isExecutedOnClient": true } } ] }, { "id": "ycv3zgly0spaovtsckykcom9", "title": "Fluxo", "graphCoordinates": { "x": 762, "y": 192 }, "blocks": [ { "id": "fo02bybce2ca3uwwxl9t1i15", "groupId": "ycv3zgly0spaovtsckykcom9", "type": "text", "content": { "richText": [ { "type": "p", "children": [ { "text": "{{saudacao}}" } ] } ] } }, { "id": "y0l7indhnw5y5wjrvwfmxr7e", "groupId": "ycv3zgly0spaovtsckykcom9", "type": "text", "content": { "richText": [ { "type": "p", "children": [ { "text": "Esculte uma boa música" } ] } ] } }, { "id": "fa7rjjdp8etlczt75nt92byw", "groupId": "ycv3zgly0spaovtsckykcom9", "type": "text", "content": { "richText": [ { "type": "p", "children": [ { "text": "╔════════════════╗" } ] }, { "type": "p", "children": [ { "text": "┃ ▁▂▃▅▆▇ 100% |" } ] }, { "type": "p", "children": [ { "text": "╚════════════════╝" } ] }, { "type": "p", "children": [ { "text": "SONG: 𝙱𝚕𝖺𝚌𝚔𝚂𝚝𝗈𝚛𝚖𝚂𝚝𝚍.𝚁𝚎𝚖𝚒𝚡 𝟼𝙼♫" } ] }, { "type": "p", "children": [ { "text": "CREATOR: 𝙱𝚕𝚊𝚌𝚔𝚂𝚝𝚘𝚛𝚖 𝚂𝚝𝚞𝚍𝚒𝚘𝚜™®" } ] }, { "type": "p", "children": [ { "text": "0:35 ━❍──────── -5:25" } ] }, { "type": "p", "children": [ { "text": "↻ ⊲ Ⅱ ⊳ ↺" } ] } ] } } ] } ], "edges": [ { "id": "i2zi8k5z6awaiwuuepsfnu4g", "from": { "groupId": "gil4ln85tcyfr5n5p3utqbvd", "blockId": "f1hwzp3exgim7i8j04re4s4l" }, "to": { "groupId": "c1saf3c4himwxy8lnh1v49y1" } }, { "id": "ft18i9oqkp6pusm8vsk7r9qs", "from": { "groupId": "c1saf3c4himwxy8lnh1v49y1", "blockId": "zvnvff3rmbsh8b3wyb372dzh" }, "to": { "groupId": "ycv3zgly0spaovtsckykcom9" } } ], "variables": [ { "id": "vz86mn60nk870kdefhbvrov3r", "name": "data" }, { "id": "vp8od10kng0salkymug9wufam", "name": "saudacao" } ], "theme": { "general": { "font": "Open Sans", "background": { "type": "Color", "content": "#ffffff" } }, "chat": { "hostAvatar": { "isEnabled": true }, "hostBubbles": { "backgroundColor": "#F7F8FF", "color": "#303235" }, "guestBubbles": { "backgroundColor": "#FF8E21", "color": "#FFFFFF" }, "buttons": { "backgroundColor": "#0042DA", "color": "#FFFFFF" }, "inputs": { "backgroundColor": "#FFFFFF", "color": "#303235", "placeholderColor": "#9095A0" } } }, "selectedThemeTemplateId": null, "settings": { "general": { "isBrandingEnabled": false, "isInputPrefillEnabled": true, "isHideQueryParamsEnabled": true, "rememberUser": { "isEnabled": false } }, "typingEmulation": { "enabled": true, "speed": 300, "maxDelay": 1.5 }, "metadata": { "description": "Build beautiful conversational forms and embed them directly in your applications without a line of code. Triple your response rate and collect answers that has more value compared to a traditional form." } }, "createdAt": "2023-10-15T08:40:14.151Z", "updatedAt": "2023-10-15T22:24:28.641Z", "icon": null, "folderId": null, "publicId": "saudacao", "customDomain": null, "workspaceId": "clnr64nj00001n21oaw5nat15", "resultsTablePreferences": null, "isArchived": false, "isClosed": false, "whatsAppCredentialsId": null }
Sobre o Autor