#+title: Lesson 02 | n8n foundations (workflows, variables, etc)
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../_share/media/css/herk.css" />
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../../_share/media/css/org-media-sass/collapsible.css" />
#+HTML_HEAD: <script src="../../_share/media/js/collapsible.js"></script>

* Links
#+attr_html: :class links
- [[../toc.org][TOC | Build n8n ai agents 8 hr course]]
- [[https://www.youtube.com/watch?v=Ey18PDiaAYI][Course Video]]

*** timestamps
:PROPERTIES:
:CUSTOM_ID: timestamp
:END:

#+attr_html: :class playlist
- [[https://www.youtube.com/watch?v=Ey18PDiaAYI&t=725s][0:12:05 n8n Foundations (workflows, variables, JSON)]]

* Notes
- n8n lets you automate anything

** templates
- n8n
- nate herk

** credentials
- in order to use any api you usually need some kind of credentials

** workflow
*** node structure
- every node has three main parts
  - input
  - configuration
    - credentials
  - output

*** adding new credentials

**** open ai
- go to Dashboard
- select API keys


- key:
     ~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~

**** add the api key
- in n8n
- go to the tool (message a model)
- go to "credential to connect with"
- select "create new credential"
- enter the API key
- in the upper left hand corner where it says "Open AI" you can rename that to whatever you want, ie the api key name

**** change the Model used
- go to 'from list' in the Model section
- pick GPT-4.1-MINI

*** test it
- add something to prompt
  ~tell me a joke~
- click execute and see the results

*** output panel has 3 options
- schema
- table
- json

*** connect the output with another tool
**** get the set Edit field
- click on the + button
- in the search bar, enter 'set' and pick the Edit Fields node

**** modify the node
- click 'Fields to Set'
- type in a name for the variable
- from the Input panel drag the paprt you want to 'value'

** trigger types
- manual trigger
- chat trigger

*** using chat trigger
- go to 'message a model' node
- delete whatever is in the prompt field
- drag chatInput to the prompt field

** templates
*** n8n company
- http://n8n.com
- go to Product->Templates
- choose tiktok clone template

*** set up telegram account
- API Key ::  ~7944661605:AAFko2fVauPj_iNALgNf-WDr9wUrVEGDTzs~
- bot username :: ~on_tutorial_nate_clone_bot~
- bot name :: ~n8n-herk-tutorial-tiktok-clone~
