{
  "id": "Of10PBmKWXdL1Ozs",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram Crypto Bot Template",
  "tags": [],
  "nodes": [
    {
      "id": "190f0744-a2ae-44c7-bb83-6fe2a88d5313",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        0,
        256
      ],
      "parameters": {
        "updates": [
          "message",
          "callback_query"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0033526f-8621-4682-a54e-91ac5cfbb468",
      "name": "Create a User Wallet",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1120,
        784
      ],
      "parameters": {
        "name": "=chatid-{{ $('Telegram Trigger').item.json.message.chat.id }}",
        "chainId": 97,
        "options": {},
        "resource": "wallets",
        "operation": "create",
        "description": "={{ $('Telegram Trigger').item.json.message.from.first_name }}, {{ $('Telegram Trigger').item.json.message.from.last_name }}, {{ $('Telegram Trigger').item.json.message.chat.id }}"
      },
      "credentials": {
        "oneShotOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2881403f-63ea-4cee-83e8-d465ed3f3af8",
      "name": "Send User Wallet Address",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1568,
        784
      ],
      "parameters": {
        "text": "=You're wallet address is: {{ $('Create a User Wallet').item.json.accountAddress }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6607bc9e-1e64-4592-9815-8f7fca3b49d4",
      "name": "Switch on User Button Choice",
      "type": "n8n-nodes-base.switch",
      "position": [
        672,
        -48
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "64ad8225-177d-43a9-bbe1-492ddb7ee717",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Telegram Trigger').item.json.callback_query.data }}",
                    "rightValue": "create-token"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "717968f3-f2d4-4dcb-8c20-97a32902c9f2",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Telegram Trigger').item.json.callback_query.data }}",
                    "rightValue": "send-tokens"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "57bda2bc-dd86-4a87-9cdc-8718e16e7b8f",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Telegram Trigger').item.json.callback_query.data }}",
                    "rightValue": "list-tokens"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "de644b74-bbb9-4122-95dd-03e4a18e1402",
      "name": "Send Action Keyboard Options",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1344,
        592
      ],
      "parameters": {
        "text": "=You're wallet address is: `{{ $json.accountAddress }}`\nIt has {{ $json.accountBalanceDetails.balance }} BNB",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "Create a token",
                    "additionalFields": {
                      "callback_data": "create-token"
                    }
                  },
                  {
                    "text": "Send Some Tokens",
                    "additionalFields": {
                      "callback_data": "send-tokens"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "See My Tokens",
                    "additionalFields": {
                      "callback_data": "list-tokens"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "430f6c1b-f7f7-48c3-bf44-e9326dfa8fc3",
      "name": "Get the name of the token",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        -416
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "message": "What do you want to call the token?",
        "options": {
          "appendAttribution": false,
          "responseFormDescription": "The name your token will have in user wallets."
        },
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "50d56b8e-6685-4cab-a57d-b14f2301275b",
      "name": "Get the token Symbol",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1120,
        -416
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "message": "What do you want the token symbol to be?",
        "options": {
          "appendAttribution": false,
          "responseFormDescription": "The ticker that will appear next to a user's balance in their wallet."
        },
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "01f7be1b-e7a2-44a0-bd60-2864b4e6967e",
      "name": "Creation Confirmation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1552,
        -416
      ],
      "parameters": {
        "text": "=Creating {{ $('Get the name of the token').item.json.data.text }} ({{ $json.data.text }})",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bee6518b-9f87-4951-bf9d-36c6e18922a0",
      "name": "Reply with Token Address",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2224,
        -512
      ],
      "parameters": {
        "text": "={{ $('Get the name of the token').item.json.data.text }} deployed at `{{ $('Deploy User Token').item.json.logs[2].args[0] }}`",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c25342da-c718-4fa7-874b-2f0427d03838",
      "name": "Try Again",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2000,
        -320
      ],
      "parameters": {
        "text": "Token launch failed, please check your wallet has gas funds and try again.",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "05bc850b-8d8a-45d6-a0ab-b0c866755b45",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -32
      ],
      "parameters": {
        "color": 5,
        "width": 624,
        "height": 448,
        "content": "## Telegram Entrypoint\n\nTrigger the workflows on either a message from a user in a DM or a callback query from a inline keyboard\n\nIMPORTANT - for this template, the chatid is used at the immutable id link between a user and their 1Shot API wallet. So in your bot settings, be sure to disable Groups to prevent creating wallets shared between group members. You could change the workflow to use the Telegram username instead, but usernames can be changed and Telegram users are also NOT guaranteed to have a username set. "
      },
      "typeVersion": 1
    },
    {
      "id": "388e847c-322f-42c4-a020-d09abe4f893c",
      "name": "Check for Existing User",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        672,
        688
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "chatid",
              "keyValue": "={{ $json.message.chat.id }}"
            }
          ]
        },
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "cIMEqMtBcIk1Pcid",
          "cachedResultUrl": "/projects/DJCvX3apkQ6WBaP9/datatables/cIMEqMtBcIk1Pcid",
          "cachedResultName": "User Table"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "aee06c0a-1e0c-4a8b-aed9-6663d003d4c5",
      "name": "Only respond to /start Messages",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        688
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0668046c-3d12-4dad-8a32-5e9276867e48",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Telegram Trigger').item.json.message.text }}",
              "rightValue": "/start"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6ae12b5c-0a77-4132-9bd3-29153053f512",
      "name": "Does the User Have A Wallet",
      "type": "n8n-nodes-base.if",
      "position": [
        896,
        688
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "94abd6d0-00e8-4b3e-945c-49d502a94777",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.wallet }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4cd5acd3-4c0f-4372-8855-129c85459f69",
      "name": "Record User Wallet",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1344,
        784
      ],
      "parameters": {
        "columns": {
          "value": {
            "chatid": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
            "wallet": "={{ $json.accountAddress }}",
            "walletid": "={{ $json.id }}"
          },
          "schema": [
            {
              "id": "chatid",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "chatid",
              "defaultMatch": false
            },
            {
              "id": "wallet",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "wallet",
              "defaultMatch": false
            },
            {
              "id": "walletid",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "walletid",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "cIMEqMtBcIk1Pcid",
          "cachedResultUrl": "/projects/DJCvX3apkQ6WBaP9/datatables/cIMEqMtBcIk1Pcid",
          "cachedResultName": "User Table"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b27531d9-e778-4764-a523-ab1b0bdd02f2",
      "name": "Callback or Message",
      "type": "n8n-nodes-base.switch",
      "position": [
        224,
        256
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "87f177f0-9898-4d4c-bb0b-1cae2b8b188a",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Telegram Trigger').item.json.callback_query }}",
                    "rightValue": ""
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e371c00a-4b75-4876-a8fc-5bba45234b61",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Telegram Trigger').item.json.message }}",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "63d96d7c-6c2f-4fef-9e24-2cbbc3e78788",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        -256
      ],
      "parameters": {
        "color": 6,
        "width": 448,
        "height": 432,
        "content": "## Handle Keyboard Options\n\nThe keyboard callback options are set in \"Send Action Keyboard Options\". This node switches on the user selections.\n\nThe branch should only be triggered once the user has a wallet."
      },
      "typeVersion": 1
    },
    {
      "id": "ee684de6-f4c8-4208-87e5-71a4d78f3a3b",
      "name": "Get User's Tokens",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        896,
        416
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "chatid",
              "keyValue": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id.toString() }}",
              "condition": "ilike"
            }
          ]
        },
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "cXlOHxQFGfGoptRd",
          "cachedResultUrl": "/projects/DJCvX3apkQ6WBaP9/datatables/cXlOHxQFGfGoptRd",
          "cachedResultName": "Token Table"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "7a8f9854-2baf-4bdf-9cca-164efd8efb6d",
      "name": "Generate Message",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        416
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nconst addresses = $input.all().map(item => `\\`${item.json.token}\\``);\nlet message =  \"Your token addresses:\\n\" + addresses.join(\"\\n\")\n\n$input.all()[0].json.message = message;\n\n// If other items exist, they pass through untouched\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "1b8a011d-3600-4cad-af9a-49dc8ad10628",
      "name": "Record New Token",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        2000,
        -512
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $('Get the name of the token').item.json.data.text }}",
            "token": "YOUR_CREDENTIAL_HERE",
            "Wallet": "={{ $('Lookup User Wallet').item.json.wallet }}",
            "chatid": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}"
          },
          "schema": [
            {
              "id": "Wallet",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Wallet",
              "defaultMatch": false
            },
            {
              "id": "token",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "token",
              "defaultMatch": false
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false
            },
            {
              "id": "chatid",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "chatid",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "cXlOHxQFGfGoptRd",
          "cachedResultUrl": "/projects/DJCvX3apkQ6WBaP9/datatables/cXlOHxQFGfGoptRd",
          "cachedResultName": "Token Table"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "64ca9c9e-7053-4574-847f-d743e3e99d6c",
      "name": "Lookup User Wallet",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        448,
        -32
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "chatid",
              "keyValue": "={{ $json.callback_query.message.chat.id.toString() }}"
            }
          ]
        },
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "cIMEqMtBcIk1Pcid",
          "cachedResultUrl": "/projects/DJCvX3apkQ6WBaP9/datatables/cIMEqMtBcIk1Pcid",
          "cachedResultName": "User Table"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9bb3a6ab-fdd9-4ab2-b2f2-e87bda8947a2",
      "name": "Get User Wallet Balance",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        1120,
        592
      ],
      "parameters": {
        "name": "={{ $json.chatid }}",
        "chainId": 97,
        "options": {},
        "resource": "wallets"
      },
      "credentials": {
        "oneShotOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "62abadc9-492f-497b-901a-9e989a1891ca",
      "name": "Which Token?",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        32
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "message": "Which token do you want to send?",
        "options": {
          "appendAttribution": false,
          "responseFormDescription": "The address of the token to send."
        },
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6129c127-91e0-4a57-9390-b371151af114",
      "name": "How Many?",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1120,
        32
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "message": "How many tokens do you want to send?",
        "options": {
          "appendAttribution": false,
          "responseFormDescription": "How many tokens do you want to send."
        },
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3b54f188-dbf6-4981-9183-3a6f86f20478",
      "name": "To What Address?",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1344,
        32
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "message": "What address do you want to send them to?",
        "options": {
          "appendAttribution": false,
          "responseFormDescription": "What address do you want to send the tokens to. "
        },
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "51776ea7-0b98-4f7d-9b3c-621027b26cae",
      "name": "Reply with TX Hash",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1792,
        -64
      ],
      "parameters": {
        "text": "=Tokens sent, tx-hash: `{{ $json.transactionHash }}`",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ccc1a477-b8db-409f-905d-15fffbd4b4db",
      "name": "Send Token List",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1344,
        416
      ],
      "parameters": {
        "text": "={{ $input.first().json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "9774fd62-ec06-4ffd-9331-06a386638e4b",
      "name": "Send Tokens",
      "type": "n8n-nodes-1shot.oneShotSynch",
      "position": [
        1568,
        32
      ],
      "parameters": {
        "params": "={\n  \"to\": \"{{ $json.data.text }}\",\n  \"amount\": \"{{ $('How Many?').item.json.data.text + \"000000000000000000\"}}\"\n} ",
        "additionalFields": {
          "memo": "=chatid-{{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}: sending tokens",
          "walletId": "={{ $('Lookup User Wallet').item.json.walletid }}",
          "contractAddress": "={{ $('Which Token?').item.json.data.text }}"
        },
        "contractMethodId": "6369ad5e-1ea8-416a-9e14-3ae07f0a0bd1"
      },
      "credentials": {
        "oneShotOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "64b90b35-5bb8-4dd9-933e-b7ea3b426320",
      "name": "Failure to Send Tokens",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1792,
        128
      ],
      "parameters": {
        "text": "=Failed to send tokens. Please check your wallet balance for gas and try again.",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6f5c8f10-d163-4334-a3d8-8bad4a2b16a5",
      "name": "Deploy User Token",
      "type": "n8n-nodes-1shot.oneShotSynch",
      "position": [
        1760,
        -416
      ],
      "parameters": {
        "params": "={\n  \"admin\": \"{{ $('Lookup User Wallet').item.json.wallet }}\",\n  \"name\": \"{{ $('Get the name of the token').item.json.data.text }}\",\n  \"ticker\": \"{{ $('Get the token Symbol').item.json.data.text }}\",\n  \"premint\": \"{{ $('Max Supply').item.json.data.text + \"000000000000000000\" }}\"\n} ",
        "additionalFields": {
          "memo": "=chatid-{{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}-{{ $('Get the name of the token').item.json.data.text }}",
          "walletId": "={{ $('Lookup User Wallet').item.json.walletid }}"
        },
        "contractMethodId": "d1459dee-e529-4e7c-b27d-4cdbddb6a72f"
      },
      "credentials": {
        "oneShotOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3d2b990f-663a-4f40-9e10-2774c43c7a3e",
      "name": "Max Supply",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1328,
        -416
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query.message.chat.id }}",
        "message": "What do you want want the max supply of the token to be (number)?",
        "options": {
          "appendAttribution": false,
          "responseFormDescription": "The ticker that will appear in user wallets for your token."
        },
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3cfa9fa7-d866-428b-a17c-cd8bdb040e1c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        -656
      ],
      "parameters": {
        "color": 2,
        "width": 1568,
        "height": 480,
        "content": "## Deploy ERC-20 Tokens with the 1Shot Token Factory\n\nThis template uses the [1Shot Token Factory](https://github.com/1Shot-API/1Shot-Token-Factory) to deploy standard ERC-20 tokens. You can clone this repo, customize the smart contracts, and redeploy it on any EVM network to launch tokens for free. \n\nWhen deploying a token, you must specify its name, symbol, admin address (which has the permissions to mint tokens), and the max supply cap. "
      },
      "typeVersion": 1
    },
    {
      "id": "56963c95-cb8e-4bd0-926a-f0036afe7580",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -1024
      ],
      "parameters": {
        "width": 664,
        "height": 988,
        "content": "# Create Your Own Telegram Crypto Bot\nThis workflow template can be used as a starting point for your own Telegram bot that creates wallets for your users that they can use for making onchain transactions.\n\n## How It Works\n\nThis template connects to a Telegram bot that you create using the Telegram BotFather bot. Users can then interact with your bot to create a personal EVM wallet and submit transactions from their wallet via inline keyboard options when interacting with your bot.\n\n[1Shot API](https://1shotapi.com) nodes are used for creating user wallets and managing transaction lifecycle and history. \n\n## Setup Steps\n\n1. Create a Telegram bot with the [BotFather](https://t.me/BotFather) bot and use its access token to authenticate the Telegram nodes. \n2. Create two data tables: `User Table` and `Token Table`. \n3. Create a free [1Shot API](https://1shotapi.com) account and generate an API key & secret to authenticate the 1Shot API nodes. \n4. Import the [Token Factory](https://github.com/1Shot-API/1Shot-Token-Factory) methods to your 1Shot API account and point the `Deploy User Token` and `Send Token` nodes at the `deployToken` and `mint` methods respectively. \n\n## Watch the Complete Walkthrough Tutorial\nWatch the [YouTube tutorial](https://youtu.be/bKRvt2DuVKA) for a complete walkthrough.\n@[youtube](bKRvt2DuVKA)"
      },
      "typeVersion": 1
    },
    {
      "id": "e42798a1-f205-4aaf-b6d7-eea01323dfcc",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        576
      ],
      "parameters": {
        "color": 4,
        "width": 1488,
        "height": 688,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Main User Entrypoint\n\nThe user can only trigger the bot by sending the `/start` command; customize this for your purposes. \n\n### Wallets\n\nThe first time a user triggers your bot, a wallet will be created for them in 1Shot API & the user logged in a datatable. When the user sends the `/start` command again, the bot will send the users wallet address and its current balance. \n\n### Data Tables\n\nThis workflow needs two data tables: `User Table` and `Token Table`. \n\nThe `User Table` should have `chatid`, `wallet` and `walletid` as columns. The `Token Table` should have `wallet`, `token`, `name` and `chatid` as columns. "
      },
      "typeVersion": 1
    },
    {
      "id": "50ae176c-1735-4eae-a92d-924cd51d802f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        304
      ],
      "parameters": {
        "color": 6,
        "width": 704,
        "height": 256,
        "content": "## Send the User's Currently Deployed Token Addresses\n\nThis branch is triggered when the user clicks the inline keyboard option `See My Tokens`. "
      },
      "typeVersion": 1
    },
    {
      "id": "7ebaa184-2854-429b-bb6d-c66c668266e4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        -160
      ],
      "parameters": {
        "color": 3,
        "width": 1136,
        "height": 448,
        "content": "## Send Tokens Using the User's Wallet\n\nThis branch is triggered when the user asks to send tokens using the inline keyboard. The transaction will be submitted from their wallet against their token using wallet and contract override options. "
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a5fff2f3-0484-444b-8863-7cfb4320f697",
  "connections": {
    "How Many?": {
      "main": [
        [
          {
            "node": "To What Address?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Max Supply": {
      "main": [
        [
          {
            "node": "Creation Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Tokens": {
      "main": [
        [
          {
            "node": "Reply with TX Hash",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Failure to Send Tokens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Which Token?": {
      "main": [
        [
          {
            "node": "How Many?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Message": {
      "main": [
        [
          {
            "node": "Send Token List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record New Token": {
      "main": [
        [
          {
            "node": "Reply with Token Address",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Callback or Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "To What Address?": {
      "main": [
        [
          {
            "node": "Send Tokens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deploy User Token": {
      "main": [
        [
          {
            "node": "Record New Token",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Try Again",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get User's Tokens": {
      "main": [
        [
          {
            "node": "Generate Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lookup User Wallet": {
      "main": [
        [
          {
            "node": "Switch on User Button Choice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record User Wallet": {
      "main": [
        [
          {
            "node": "Send User Wallet Address",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Callback or Message": {
      "main": [
        [
          {
            "node": "Lookup User Wallet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Only respond to /start Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a User Wallet": {
      "main": [
        [
          {
            "node": "Record User Wallet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the token Symbol": {
      "main": [
        [
          {
            "node": "Max Supply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Creation Confirmation": {
      "main": [
        [
          {
            "node": "Deploy User Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Existing User": {
      "main": [
        [
          {
            "node": "Does the User Have A Wallet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get User Wallet Balance": {
      "main": [
        [
          {
            "node": "Send Action Keyboard Options",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the name of the token": {
      "main": [
        [
          {
            "node": "Get the token Symbol",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Does the User Have A Wallet": {
      "main": [
        [
          {
            "node": "Get User Wallet Balance",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create a User Wallet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch on User Button Choice": {
      "main": [
        [
          {
            "node": "Get the name of the token",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Which Token?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get User's Tokens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only respond to /start Messages": {
      "main": [
        [
          {
            "node": "Check for Existing User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}