Skip to content

Instantly share code, notes, and snippets.

@arladmin
Last active December 6, 2021 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arladmin/4b4b4b00400959f49f4fce29bf067d84 to your computer and use it in GitHub Desktop.
Save arladmin/4b4b4b00400959f49f4fce29bf067d84 to your computer and use it in GitHub Desktop.
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
90,
310
]
},
{
"parameters": {
"chatId": "={{$node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"]}}",
"text": "There are no active sessions for this chat!\nTo start a new one, use \"get_question\" command.",
"additionalFields": {}
},
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1030,
940
],
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
},
{
"parameters": {
"updates": [
"message",
"callback_query",
"*"
],
"additionalFields": {}
},
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1,
"position": [
90,
490
],
"webhookId": "60577905-7f6c-4ac1-9f13-929f26cd3a50",
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"Telegram Trigger\"].json[\"message\"].hasOwnProperty('entities') }}",
"value2": true
}
]
}
},
"name": "IF valid command?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
260,
490
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"Check for Session\"].json.hasOwnProperty(\"id\") }}",
"value2": true
}
]
}
},
"name": "IF Session exists?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
830,
200
]
},
{
"parameters": {
"operation": "list",
"application": "quiz_base_id",
"table": "Session",
"additionalOptions": {
"filterByFormula": "=AND({ChatID}={{$node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"]}},{Status}=\"Active\")"
}
},
"name": "Check for Session",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
650,
200
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"application": "quiz_base_id",
"table": "Session",
"id": "={{$node[\"IF Session exists?\"].json[\"id\"]}}"
},
"name": "Get Session details",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
1030,
80
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"operation": "append",
"application": "quiz_base_id",
"table": "Session",
"addAllFields": false,
"fields": [
"ChatID",
"Status",
"Count of Attempts"
],
"options": {
"typecast": true
}
},
"name": "Create new Session",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
1200,
300
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "ChatID",
"value": "={{String($node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"])}}"
},
{
"name": "Status",
"value": "Active"
}
],
"number": [
{
"name": "Count of Attempts"
}
]
},
"options": {}
},
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1030,
300
]
},
{
"parameters": {
"functionCode": "const staticData = getWorkflowStaticData('global');\n\n// Access its data\n//const Session = staticData.Session;\n\n// Update its data\nstaticData.Session = {\n id:items[0].json.fields.SessionID,\n questions:items[0].json.fields.title\n};\n\nreturn items;"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1200,
80
]
},
{
"parameters": {
"operation": "list",
"application": "quiz_base_id",
"table": "MCQ",
"returnAll": false,
"limit": 1,
"additionalOptions": {
"filterByFormula": "={{$node[\"Function1\"].json[\"search_query\"] || \"\"}}",
"sort": {
"property": [
{
"field": "Correct Answer"
}
]
},
"view": "Active"
}
},
"name": "Get a new Question",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
1550,
180
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"functionCode": "const staticData = getWorkflowStaticData('global');\n\ntry{\n if($node[\"Function\"]){\n if($node[\"Function\"].json !== \"\"){ \n staticData.Session = {\n rec_id:items[0].json.id,\n id:items[0].json.fields.SessionID,\n questions:items[0].json.fields.title\n };\n items[0].json.Session = {\n rec_id:items[0].json.id,\n id:items[0].json.fields.SessionID,\n questions:items[0].json.fields.title || []\n };\n let rejects = items[0].json.fields.title.map(i => {\n return (`{title}!=\"${i}\"`);\n });\n items[0].json.search_query = `AND(${[...rejects]})`;\n } \n }\n} catch {\n try{\n if($node[\"Create new Session\"].json !== \"\"){\n staticData.Session = {\n rec_id:items[0].json.id,\n id:items[0].json.fields.SessionID,\n questions:[]\n };\n items[0].json.Session = {\n rec_id:items[0].json.id,\n id:items[0].json.fields.SessionID,\n questions:[]\n };\n }\n } catch {\n items[0].json.Session = {\n rec_id:items[0].json.id,\n id:items[0].json.fields.SessionID,\n questions:[]\n };\n }\n}\nreturn items;\n"
},
"name": "Function1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1370,
180
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "MCQ",
"value": "={{[$node[\"Get a new Question\"].json[\"id\"]].concat($node[\"Function1\"].json[\"fields\"][\"MCQ\"] || [])}}"
}
]
},
"options": {}
},
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1730,
180
]
},
{
"parameters": {
"operation": "update",
"application": "quiz_base_id",
"table": "Session",
"id": "={{$node[\"Function1\"].json[\"Session\"][\"rec_id\"]}}",
"updateAllFields": false,
"fields": [
"MCQ"
],
"options": {
"typecast": true
}
},
"name": "Add Q. to Session",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
1910,
180
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"dataType": "string",
"value1": "={{($node[\"Telegram Trigger\"].json[\"message\"][\"text\"]).match(/^(\\/[a-zA-Z0-9_]+)@?.{0,}$/)[1]}}",
"rules": {
"rules": [
{
"value2": "/get_question"
},
{
"value2": "/reset_session",
"output": 1
},
{
"value2": "/current_session",
"output": 2
},
{
"value2": "/start",
"output": 3
}
]
}
},
"name": "Switch",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
430,
490
]
},
{
"parameters": {
"operation": "list",
"application": "quiz_base_id",
"table": "Session",
"additionalOptions": {
"filterByFormula": "=AND({ChatID}={{$node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"]}},{Status}=\"Active\")"
}
},
"name": "Check for Session1",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
630,
480
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"name": "SplitInBatches",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
840,
480
]
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"SplitInBatches\"].context[\"noItemsLeft\"]}}",
"value2": true
}
]
}
},
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1400,
670
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "Status",
"value": "Closed"
},
{
"name": "ClosedAt",
"value": "={{new Date().toISOString()}}"
}
]
},
"options": {}
},
"name": "Set2",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1040,
480
]
},
{
"parameters": {
"operation": "update",
"application": "quiz_base_id",
"table": "Session",
"id": "={{$node[\"SplitInBatches\"].json[\"id\"]}}",
"updateAllFields": false,
"fields": [
"Status",
"ClosedAt"
],
"options": {
"typecast": true
}
},
"name": "Close Session",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
1230,
480
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
},
"continueOnFail": true
},
{
"parameters": {
"operation": "list",
"application": "quiz_base_id",
"table": "Session",
"additionalOptions": {
"filterByFormula": "=AND({ChatID}={{$node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"]}},{Status}=\"Active\")"
}
},
"name": "Check for Session2",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
650,
820
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"application": "quiz_base_id",
"table": "Session",
"id": "={{$node[\"IF Session exists?2\"].json[\"id\"]}}"
},
"name": "Get Session details1",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
1030,
760
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"Check for Session2\"].json.hasOwnProperty(\"id\") }}",
"value2": true
}
]
}
},
"name": "IF Session exists?2",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
830,
820
]
},
{
"parameters": {
"chatId": "={{$node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"]}}",
"text": "=Questions: {{$node[\"Get Session details1\"].json[\"fields\"][\"Count of Questions\"]}}\nAttempts: {{$node[\"Get Session details1\"].json[\"fields\"][\"Count of Attempts\"]}}\nScore: {{$node[\"Get Session details1\"].json[\"fields\"][\"correct\"]}}%",
"additionalFields": {}
},
"name": "Telegram1",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1210,
760
],
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"Telegram Trigger\"].json[\"message\"].hasOwnProperty('reply_to_message') }}",
"value2": true
}
]
}
},
"name": "IF callback query?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
260,
1120
]
},
{
"parameters": {
"chatId": "={{$node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"]}}",
"text": "=\\[Category: _{{$node[\"Get a new Question\"].json[\"fields\"][\"category_name\"]}}_, Difficulty: _{{$node[\"Get a new Question\"].json[\"fields\"][\"difficulty\"]}}_]\n*{{$node[\"Get a new Question\"].json[\"fields\"][\"question\"]}}*",
"replyMarkup": "inlineKeyboard",
"inlineKeyboard": {
"rows": [
{
"row": {
"buttons": [
{
"text": "={{$node[\"Get a new Question\"].json[\"fields\"][\"Option1\"]}}",
"additionalFields": {
"callback_data": "Option1"
}
}
]
}
},
{
"row": {
"buttons": [
{
"text": "={{$node[\"Get a new Question\"].json[\"fields\"][\"Option2\"]}}",
"additionalFields": {
"callback_data": "Option2"
}
}
]
}
},
{
"row": {
"buttons": [
{
"text": "={{$node[\"Get a new Question\"].json[\"fields\"][\"Option3\"]}}",
"additionalFields": {
"callback_data": "Option3"
}
}
]
}
},
{
"row": {
"buttons": [
{
"text": "={{$node[\"Get a new Question\"].json[\"fields\"][\"Option4\"]}}",
"additionalFields": {
"callback_data": "Option4"
}
}
]
}
}
]
},
"additionalFields": {
"parse_mode": "Markdown"
}
},
"name": "Send Question1",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
2100,
180
],
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"IF callback query\"].json[\"callback_query\"][\"data\"]}}",
"value2": "={{$node[\"Get original Question1\"].json[\"fields\"][\"CorrectOption\"]}}"
}
]
}
},
"name": "Check Answer1",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
950,
1290
]
},
{
"parameters": {
"operation": "list",
"application": "quiz_base_id",
"table": "MCQ",
"returnAll": false,
"limit": 1,
"additionalOptions": {
"filterByFormula": "=FIND('{{$node[\"Function4\"].json[\"text\"]}}',{question})>0",
"sort": {
"property": [
{
"field": "id"
}
]
},
"view": "Active"
}
},
"name": "Get original Question1",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
740,
1290
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"operation": "update",
"application": "quiz_base_id",
"table": "Session",
"id": "={{$node[\"Get Session\"].json[\"id\"]}}",
"updateAllFields": false,
"fields": [
"CorrectlyAnswered",
"WronglyAnswered",
"Count of Attempts"
],
"options": {
"typecast": true
}
},
"name": "Update answer in Session2",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
2070,
1220
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"operation": "update",
"application": "quiz_base_id",
"table": "Session",
"id": "={{$node[\"Get Session3\"].json[\"id\"]}}",
"updateAllFields": false,
"fields": [
"WronglyAnswered",
"CorrectlyAnswered",
"Count of Attempts"
],
"options": {
"typecast": true
}
},
"name": "Update answer in Session3",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
2040,
1400
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"operation": "list",
"application": "quiz_base_id",
"table": "Session",
"additionalOptions": {
"filterByFormula": "=AND({ChatID}={{$node[\"Telegram Trigger\"].json[\"callback_query\"][\"message\"][\"chat\"][\"id\"]}},{Status}=\"Active\")"
}
},
"name": "Get Session",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
1540,
1220
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"operation": "list",
"application": "quiz_base_id",
"table": "Session",
"additionalOptions": {
"filterByFormula": "=AND({ChatID}={{$node[\"Telegram Trigger\"].json[\"callback_query\"][\"message\"][\"chat\"][\"id\"]}},{Status}=\"Active\")"
}
},
"name": "Get Session3",
"type": "n8n-nodes-base.airtable",
"typeVersion": 1,
"position": [
1370,
1400
],
"alwaysOutputData": true,
"credentials": {
"airtableApi": "Quiz Database"
}
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "WronglyAnswered",
"value": "={{$node[\"Function2\"].json[\"results\"][\"wrong\"]}}"
},
{
"name": "CorrectlyAnswered",
"value": "={{$node[\"Function2\"].json[\"results\"][\"correct\"]}}"
}
],
"number": [
{
"name": "Count of Attempts",
"value": "={{$node[\"Function2\"].json[\"results\"][\"attempts\"]}}"
}
]
},
"options": {}
},
"name": "Set Wrong Answer1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1800,
1400
]
},
{
"parameters": {
"resource": "callback",
"queryId": "={{$node[\"IF callback query\"].json[\"callback_query\"][\"id\"]}}",
"additionalFields": {
"cache_time": 5,
"show_alert": true,
"text": "Correct!"
}
},
"name": "Telegram4",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1170,
1220
],
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
},
{
"parameters": {
"resource": "callback",
"queryId": "={{$node[\"IF callback query\"].json[\"callback_query\"][\"id\"]}}",
"additionalFields": {
"cache_time": 5,
"show_alert": true,
"text": "Wrong!"
}
},
"name": "Telegram5",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1170,
1400
],
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$node[\"Telegram Trigger\"].json.hasOwnProperty('callback_query') }}",
"value2": true
}
]
}
},
"name": "IF callback query",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
260,
1310
]
},
{
"parameters": {
"chatId": "={{$node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"]}}",
"text": "<b>Your session has been reset. To start a new one, use \"get_question\" command.</b>",
"replyMarkup": "replyKeyboardRemove",
"replyKeyboardRemove": {
"remove_keyboard": true
},
"additionalFields": {
"parse_mode": "HTML"
}
},
"name": "Successful Reset Message",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1610,
650
],
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
},
{
"parameters": {
"functionCode": "let correct_list = new Set( $node[\"Get Session3\"].json[\"fields\"][\"CorrectlyAnswered\"]);\nlet wrong_list = new Set( $node[\"Get Session3\"].json[\"fields\"][\"WronglyAnswered\"]);\n\nlet wrong_ans = $node[\"Get original Question1\"].json[\"id\"];\nlet attempts = $node[\"Get Session3\"].json[\"fields\"][\"Count of Attempts\"]+1;\n\ncorrect_list.delete(wrong_ans);\nwrong_list.add(wrong_ans);\n\nitems[0].json.results = {\n correct: [...correct_list],\n wrong: [...wrong_list],\n attempts: attempts\n};\n\nreturn items;"
},
"name": "Function2",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1590,
1400
]
},
{
"parameters": {
"functionCode": "let correct_list = new Set( $node[\"Get Session\"].json[\"fields\"][\"CorrectlyAnswered\"]);\nlet wrong_list = new Set( $node[\"Get Session\"].json[\"fields\"][\"WronglyAnswered\"]);\n\nlet correct_ans = $node[\"Get original Question1\"].json[\"id\"];\nlet attempts = $node[\"Get Session\"].json[\"fields\"][\"Count of Attempts\"]+1;\n\ncorrect_list.add(correct_ans);\nwrong_list.delete(correct_ans);\n\nitems[0].json.results = {\n correct: [...correct_list],\n wrong: [...wrong_list],\n attempts: attempts \n};\n\nreturn items;"
},
"name": "Function3",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1690,
1220
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "WronglyAnswered",
"value": "={{$node[\"Function3\"].json[\"results\"][\"wrong\"]}}"
},
{
"name": "CorrectlyAnswered",
"value": "={{$node[\"Function3\"].json[\"results\"][\"correct\"]}}"
}
],
"number": [
{
"name": "Count of Attempts",
"value": "={{$node[\"Function3\"].json[\"results\"][\"attempts\"]}}"
}
]
},
"options": {}
},
"name": "Set Correct Answer1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1860,
1220
]
},
{
"parameters": {
"operation": "editMessageText",
"chatId": "={{$node[\"IF callback query\"].json[\"callback_query\"][\"message\"][\"chat\"][\"id\"]}}",
"messageId": "={{$node[\"IF callback query\"].json[\"callback_query\"][\"message\"][\"message_id\"]}}",
"replyMarkup": "inlineKeyboard",
"text": "=\\[Category: _{{$node[\"Get original Question1\"].json[\"fields\"][\"category_name\"]}}_, Difficulty: _{{$node[\"Get original Question1\"].json[\"fields\"][\"difficulty\"]}}_]\n*{{$node[\"Get original Question1\"].json[\"fields\"][\"question\"]}}*\n---------------------\n✔ {{$node[\"Get original Question1\"].json[\"fields\"][\"Correct Answer\"]}}\n---------------------",
"inlineKeyboard": {
"rows": []
},
"additionalFields": {
"parse_mode": "Markdown"
}
},
"name": "Telegram6",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1350,
1220
],
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
},
{
"parameters": {
"functionCode": "let o = new String();\no = String($node[\"IF callback query\"].json[\"callback_query\"][\"message\"][\"text\"].match(/\\][\\n\\s]+([A-Z].+\\?$)/)[1]);\nlet o_r = new String();\no_r = o.replace(/'/g,\"\\\\'\");\n\nitems[0].json.text = o_r;\nreturn items;"
},
"name": "Function4",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
540,
1290
]
},
{
"parameters": {
"chatId": "={{$node[\"Telegram Trigger\"].json[\"message\"][\"chat\"][\"id\"]}}",
"text": "Welcome to the Trivia Quiz Bot.\n\nTo get questions, use the command: \n/get_question\n\nTo view your current score, use the command:\n/current_session\n\nTo reset your session and start afresh use the command:\n/reset_session",
"additionalFields": {}
},
"name": "Start message",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
650,
1070
],
"credentials": {
"telegramApi": "Trivia Quiz Bot"
}
}
],
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "IF valid command?",
"type": "main",
"index": 0
}
]
]
},
"IF valid command?": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
],
[
{
"node": "IF callback query?",
"type": "main",
"index": 0
}
]
]
},
"IF Session exists?": {
"main": [
[
{
"node": "Get Session details",
"type": "main",
"index": 0
}
],
[
{
"node": "Set",
"type": "main",
"index": 0
}
]
]
},
"Check for Session": {
"main": [
[
{
"node": "IF Session exists?",
"type": "main",
"index": 0
}
]
]
},
"Get Session details": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"Create new Session": {
"main": [
[
{
"node": "Function1",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "Create new Session",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "Function1",
"type": "main",
"index": 0
}
]
]
},
"Get a new Question": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
}
]
]
},
"Function1": {
"main": [
[
{
"node": "Get a new Question",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Add Q. to Session",
"type": "main",
"index": 0
}
]
]
},
"Add Q. to Session": {
"main": [
[
{
"node": "Send Question1",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Check for Session",
"type": "main",
"index": 0
}
],
[
{
"node": "Check for Session1",
"type": "main",
"index": 0
}
],
[
{
"node": "Check for Session2",
"type": "main",
"index": 0
}
],
[
{
"node": "Start message",
"type": "main",
"index": 0
}
]
]
},
"Check for Session1": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches": {
"main": [
[
{
"node": "Set2",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "Successful Reset Message",
"type": "main",
"index": 0
}
],
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"Set2": {
"main": [
[
{
"node": "Close Session",
"type": "main",
"index": 0
}
]
]
},
"Close Session": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"Check for Session2": {
"main": [
[
{
"node": "IF Session exists?2",
"type": "main",
"index": 0
}
]
]
},
"Get Session details1": {
"main": [
[
{
"node": "Telegram1",
"type": "main",
"index": 0
}
]
]
},
"IF Session exists?2": {
"main": [
[
{
"node": "Get Session details1",
"type": "main",
"index": 0
}
],
[
{
"node": "Telegram",
"type": "main",
"index": 0
}
]
]
},
"IF callback query?": {
"main": [
null,
[
{
"node": "IF callback query",
"type": "main",
"index": 0
}
]
]
},
"Check Answer1": {
"main": [
[
{
"node": "Telegram4",
"type": "main",
"index": 0
}
],
[
{
"node": "Telegram5",
"type": "main",
"index": 0
}
]
]
},
"Get original Question1": {
"main": [
[
{
"node": "Check Answer1",
"type": "main",
"index": 0
}
]
]
},
"Get Session": {
"main": [
[
{
"node": "Function3",
"type": "main",
"index": 0
}
]
]
},
"Get Session3": {
"main": [
[
{
"node": "Function2",
"type": "main",
"index": 0
}
]
]
},
"Set Wrong Answer1": {
"main": [
[
{
"node": "Update answer in Session3",
"type": "main",
"index": 0
}
]
]
},
"Telegram4": {
"main": [
[
{
"node": "Telegram6",
"type": "main",
"index": 0
}
]
]
},
"Telegram5": {
"main": [
[
{
"node": "Get Session3",
"type": "main",
"index": 0
}
]
]
},
"IF callback query": {
"main": [
[
{
"node": "Function4",
"type": "main",
"index": 0
}
]
]
},
"Function2": {
"main": [
[
{
"node": "Set Wrong Answer1",
"type": "main",
"index": 0
}
]
]
},
"Function3": {
"main": [
[
{
"node": "Set Correct Answer1",
"type": "main",
"index": 0
}
]
]
},
"Set Correct Answer1": {
"main": [
[
{
"node": "Update answer in Session2",
"type": "main",
"index": 0
}
]
]
},
"Telegram6": {
"main": [
[
{
"node": "Get Session",
"type": "main",
"index": 0
}
]
]
},
"Function4": {
"main": [
[
{
"node": "Get original Question1",
"type": "main",
"index": 0
}
]
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment