<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>UBOS Community: AC</title>
    <description>The latest articles on UBOS Community by AC (@anastasiia).</description>
    <link>https://community.ubos.tech/anastasiia</link>
    <image>
      <url>https://community.ubos.tech/uploads/user/profile_image/6/38115bc0-5b55-4b45-8ab5-3068dcb76a42.png</url>
      <title>UBOS Community: AC</title>
      <link>https://community.ubos.tech/anastasiia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://community.ubos.tech/feed/anastasiia"/>
    <language>en</language>
    <item>
      <title>Setting Up a Template with WooCommerce Integration</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Mon, 15 Jan 2024 14:55:11 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/nalashtuvannia-shablonu-z-intieghratsiieiu-woocommerce-32go</link>
      <guid>https://community.ubos.tech/anastasiia/nalashtuvannia-shablonu-z-intieghratsiieiu-woocommerce-32go</guid>
      <description>&lt;h1&gt;
  
  
  Setting Up a Template with WooCommerce Integration
&lt;/h1&gt;

&lt;p&gt;У цій статті будуть розглянуті всі необхідні кроки для налаштування шаблону з інтеграцією WooCommerce.&lt;/p&gt;

&lt;p&gt;Step 1: Find the Template&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the Asset Marketplace and search for [template name], or click on the link. &lt;/li&gt;
&lt;li&gt;Click Install and wait for the installation to complete.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step 2: Configure Node-RED&lt;/p&gt;

&lt;p&gt;After installation, go to the Node-RED settings.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/u6uoqibx9yv4svc6ye32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/u6uoqibx9yv4svc6ye32.png" alt="Image of Node-RED settings" width="1924" height="850"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/b93wxayqfehw2y2zw553.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/b93wxayqfehw2y2zw553.png" alt="Image of Node-RED ENV settings" width="1920" height="879"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the following environment variables to Node-RED:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;BASE_URL&lt;/code&gt; - The URL to the WooCommerce API&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WOOCOMMERCE_CONSUMER_KEY&lt;/code&gt; - The WooCommerce consumer key&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WOOCOMMERCE_CONSUMER_SECRET&lt;/code&gt; - The WooCommerce consumer secret
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://github.com/woocommerce/woocommerce/blob/trunk/docs/rest-api/getting-started.md" rel="noopener noreferrer"&gt;How to find WooCommerce keys&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Configure the UI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;secondaryColor&lt;/code&gt; - The secondary color for your site&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;primaryColor&lt;/code&gt; - The primary color for your site&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configure user roles and permissions. See the &lt;a href="https://community.ubos.tech/olha/nalashtuvannia-avtorizatsiinogho-tiemplieitu-2"&gt;instructions&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it! You've now configured your template for WooCommerce integration.&lt;/p&gt;
&lt;h2&gt;
  
  
  Description of the Template
&lt;/h2&gt;

&lt;p&gt;The template includes pages for creating categories, series, attributes, and products.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Configure the authentication module.&lt;/li&gt;
&lt;li&gt;Register in the application and add a role with access to all pages.&lt;/li&gt;
&lt;li&gt;Add several categories for your products on the Categories page. You can create categories and subcategories by selecting an existing category from the select box. It is important to fill in the Name and Slug fields. Add a description if desired, and for a subcategory, select category.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/ezv4a1iihqq9usyxcv7i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ezv4a1iihqq9usyxcv7i.png" alt="Image description" width="1920" height="917"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Series are created in a similar way to categories, but be sure to select the parent category of this series.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/ewmmn9h0cacmnmhgi7x1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ewmmn9h0cacmnmhgi7x1.png" alt="Image description" width="1918" height="920"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Attributes are an important part of the application. You can create your own or use ready-made ones. Creating a custom attribute will be described below.
Add basic attributes!!! Their name should be Color, Material and Size&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/l4iwz2e4yalbwyzlhdqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/l4iwz2e4yalbwyzlhdqp.png" alt="Image description" width="1919" height="917"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to the add terms page - these are options for each attribute. For example, you can add "red", "green", "purple" for the color. Fill in all the fields and create an additional term for the color.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Products page displays all products from the database. Let's add a product - click the "Create" button, fill in all the fields, add an image and save.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/hyhhfd96zh66g65egzc2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/hyhhfd96zh66g65egzc2.png" alt="Image description" width="1920" height="920"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you added your own attributes, you noticed that there were only standard ones on the product creation page. Let's add them from the editor: copy one of the selects, replace Label with the name of your attribute.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Replace the function with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="nx"&gt;GetAttributes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;elem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;elem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NAME_OF_YOUR_ATTRIBUTE&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;})[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;terms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;elem&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;elem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   
       &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;elem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_id&lt;/span&gt;
     &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;})}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/n0aazsvk4hb4bm8idhl7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/n0aazsvk4hb4bm8idhl7.png" alt="Image description" width="1923" height="878"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the editing page, do the same and additionally replace the Default Value function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="nx"&gt;GetProduct&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;attributes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;elem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NAME_OF_YOUR_ATTRIBUTE” === elem.name  
   })[0].option}}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/d3bzxsq0jrdea8ny3pvp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/d3bzxsq0jrdea8ny3pvp.png" alt="Image description" width="1919" height="878"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Connect UI Editor and Node-RED to GIT?</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Thu, 22 Jun 2023 07:40:27 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/how-to-connect-ui-editor-and-node-red-to-git-120f</link>
      <guid>https://community.ubos.tech/anastasiia/how-to-connect-ui-editor-and-node-red-to-git-120f</guid>
      <description>&lt;p&gt;To ensure the safety of your data, protect against possible data loss, and have universal access to your code, you can connect your applications to Git. In this example, we will use the GitLab web repository.&lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have a GitLab profile.&lt;/li&gt;
&lt;li&gt;Create two repositories without a Readme file for Node-RED and UI.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  GitLab
&lt;/h2&gt;

&lt;p&gt;In GitLab, create two projects for UI and Node-RED.&lt;br&gt;
When you are in a group, click on the "New project" button =&amp;gt;&lt;br&gt;
In the modal window, select "Create blank project" =&amp;gt;&lt;br&gt;
In the project settings, enter a name for the project and uncheck the option "Initialize repository with a README" to create it without that file =&amp;gt;&lt;br&gt;
Click "Create project".&lt;/p&gt;

&lt;p&gt;It is also important to name your project appropriately. The name should be clear and understandable. Avoid using overly brief names that require additional explanations in the Readme file to understand what the project is about. For example, naming a project "Front" or "UI" is not ideal because it doesn't convey what exactly is happening in the project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/nzczvbw1vow0mok1pxk7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/nzczvbw1vow0mok1pxk7.png" alt="Image description" width="994" height="428"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/y79ph7qoe9mfvn1s1ie1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/y79ph7qoe9mfvn1s1ie1.png" alt="Image description" width="1071" height="574"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/6vsgb7sjavcl0wai3c99.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/6vsgb7sjavcl0wai3c99.png" alt="Image description" width="1233" height="566"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/ieiok3ukbja1yirrhsht.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ieiok3ukbja1yirrhsht.png" alt="Image description" width="1108" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In GitLab, click on the "Clone" button and copy the &lt;em&gt;SSH clone URL&lt;/em&gt;.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/egnkfc46h4cj6r3oi1nb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/egnkfc46h4cj6r3oi1nb.png" alt="Image description" width="992" height="478"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  UI
&lt;/h2&gt;

&lt;p&gt;In the UI Editor, click on the "CONNECT GIT" button located in the bottom left corner.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/ieibkal935udzxbq8fvw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ieibkal935udzxbq8fvw.png" alt="Image description" width="1675" height="897"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A modal window will open, where we paste our SSH key. Then click on the "Generate key" button.&lt;br&gt;
The SSH key will appear, and we copy it.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/rnapxw36jejkt6c2umtw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/rnapxw36jejkt6c2umtw.png" alt="Image description" width="646" height="646"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, go to our GitLab account, click on the icon located in the top right corner, and select "Preferences".&lt;a href="https://community.ubos.tech/uploads/articles/qqu7m61tfp20q30cp8rs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/qqu7m61tfp20q30cp8rs.png" alt="Image description" width="437" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the left menu, select the "&lt;em&gt;SSH Keys&lt;/em&gt;" field. On the opened page, paste our generated SSH key into the "Key" field. Below, in the "Expiration date" field, click on the cross icon to remove the expiration date. Finally, click on the "&lt;strong&gt;Add key&lt;/strong&gt;" button.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/6fezukdk7uq1qtq6lxfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/6fezukdk7uq1qtq6lxfi.png" alt="Image description" width="1529" height="668"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we return to our UI Editor and click on the "Connect" button. The connection to our GitLab is established automatically, and the first commit is made. At the end, a modal window titled "&lt;strong&gt;Deploy your application&lt;/strong&gt;" is displayed, indicating that everything has been successful.&lt;/p&gt;

&lt;p&gt;Our project is now connected to GitLab. Instead of "&lt;strong&gt;CONNECT GIT&lt;/strong&gt;" a plus button is shown at the bottom. After making any changes, click on it. A modal window titled "&lt;strong&gt;Deploy your application&lt;/strong&gt;" will open, where you can enter a name for your commit in the field and click the "&lt;strong&gt;COMMIT &amp;amp; PUSH&lt;/strong&gt;" button.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/whrpgmeaxxsjpxqpipd1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/whrpgmeaxxsjpxqpipd1.png" alt="Image description" width="762" height="678"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  NodeRed
&lt;/h2&gt;

&lt;p&gt;Let's go to our NodeRed interface and click on the three lines icon located at the top right corner. This will open a menu. Click on "Projects" and select "New." Alternatively, you can use the keyboard shortcut &lt;code&gt;Ctrl + Alt + N&lt;/code&gt; to open the modal window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/bnenns6akd5vw5op6j29.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/bnenns6akd5vw5op6j29.png" alt="Image description" width="706" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose "Create Project."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/5z3tuhsqqskb53l8lxlq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/5z3tuhsqqskb53l8lxlq.png" alt="Image description" width="649" height="713"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter your username, email, and click on the "Next" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/emmfvu55o7odu96m0qs1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/emmfvu55o7odu96m0qs1.png" alt="Image description" width="765" height="720"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give a name to your project and click "Next."&lt;/p&gt;

&lt;p&gt;Next, you will be prompted to name your flow file. Leave it as is and click "&lt;strong&gt;Next&lt;/strong&gt;".&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/515kby4h2jh2tiryd3m9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/515kby4h2jh2tiryd3m9.png" alt="Image description" width="691" height="710"&gt;&lt;/a&gt;&lt;br&gt;
 &lt;a href="https://community.ubos.tech/uploads/articles/ni21ciajnk03d0c90oha.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ni21ciajnk03d0c90oha.png" alt="Image description" width="703" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, a modal window will open with encryption settings. Choose "Disable encryption" and click on "Create project." If you want to create a project with encryption, there is a link to a video tutorial in the additional information at the bottom.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/w4qzi8r48ufv7nhwnf5o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/w4qzi8r48ufv7nhwnf5o.png" alt="Image description" width="705" height="727"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to create a project in GitLab (refer to the example above). However, this time instead of copying the SSH link, we will use HTTPS (how to add SSH is explained in the video in the additional information).&lt;/p&gt;

&lt;p&gt;Then, in Node-RED, click on the three lines icon located at the top right corner to open the menu. Click on "&lt;em&gt;Projects&lt;/em&gt;" and select "&lt;em&gt;Project Settings&lt;/em&gt;".&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/1u81ot9koxw76hsqnv8k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/1u81ot9koxw76hsqnv8k.png" alt="Image description" width="584" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, in the menu, select "Settings." Click on the "Add remote" button, and in the URL field, paste the HTTPS link of our project on GitLab that you copied. Click on the "Add remote" button. Now, our NodeRed is connected to GitLab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/2btkux9xd34798g2p0yd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/2btkux9xd34798g2p0yd.png" alt="Image description" width="657" height="787"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To add changes to GitLab, click on the tree button located at the top right between the book and the bug. This is the Git management menu. &lt;br&gt;
To save changes in the remote environment, click on the "+add" button and then click on "Commit". If you don't understand the significance of these states and why we are performing these steps, refer to the official &lt;a href="https://git-scm.com/book/uk/v2/%D0%92%D1%81%D1%82%D1%83%D0%BF-%D0%A2%D1%80%D0%B8-%D1%81%D1%82%D0%B0%D0%BD%D0%B8" rel="noopener noreferrer"&gt;git documentation&lt;/a&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/9xya9sz66s6ifv288keh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/9xya9sz66s6ifv288keh.png" alt="Image description" width="622" height="852"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Write the title of your commit and click on "&lt;strong&gt;Commit&lt;/strong&gt;".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/98pqw6zl9mp9ooc4h13u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/98pqw6zl9mp9ooc4h13u.png" alt="Image description" width="411" height="817"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, click on "&lt;strong&gt;Commit History&lt;/strong&gt;" and then on the button with arrows, selecting "&lt;em&gt;Remote: None&lt;/em&gt;".&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/4s9ows3d8vo2gen9artq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/4s9ows3d8vo2gen9artq.png" alt="Image description" width="395" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A pop-up window should appear, where you need to enter your GitLab username or email with the corresponding password. Click the "&lt;strong&gt;Retry&lt;/strong&gt;" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/cpjlbhht51jidma8yu1c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/cpjlbhht51jidma8yu1c.png" alt="Image description" width="1082" height="682"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, once again, click on the tree button located at the top right between the book and the bug. Select "&lt;em&gt;Remote: None&lt;/em&gt;". If there are no branches, enter any name for the branch and click a bit lower to create it.&lt;br&gt;
 &lt;a href="https://community.ubos.tech/uploads/articles/9piq5mqdpvikv5m1nl2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/9piq5mqdpvikv5m1nl2l.png" alt="Image description" width="411" height="616"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A menu will open, and you should click on the "Push" button. Your data will be added to the GitLab repository.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/rq8vk0vs6atij3mcs80a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/rq8vk0vs6atij3mcs80a.png" alt="Image description" width="437" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additional information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.conventionalcommits.org/uk/v1.0.0/" rel="noopener noreferrer"&gt;How to write commit messages correctly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.appsmith.com/advanced-concepts/version-control-with-git/connecting-to-git-repository" rel="noopener noreferrer"&gt;Examples of connecting git on UI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=Bto2rz7bY3g&amp;amp;ab_channel=Node-RED" rel="noopener noreferrer"&gt;Introduction to Node-RED Projects - VIDEO&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>How to interact between two widgets using tabs and images as an example?</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Wed, 21 Jun 2023 21:03:02 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/how-to-interact-between-two-widgets-using-tabs-and-images-as-an-example-3jpn</link>
      <guid>https://community.ubos.tech/anastasiia/how-to-interact-between-two-widgets-using-tabs-and-images-as-an-example-3jpn</guid>
      <description>&lt;p&gt;Each widget on the platform has its own state, which is why they do not interact with each other. However, by using the global object, we can connect their functionality.&lt;/p&gt;

&lt;p&gt;For example, let's say we don't want to use the built-in tab switching functionality of the &lt;strong&gt;Tab&lt;/strong&gt; widget. Instead, we want to create separate images, and when we click on them, it will trigger the switching of tabs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you should know:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://community.ubos.tech/blue_skies/introduction-and-familiarization-with-the-ui-editor-environment-ank"&gt;UI Editor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://community.ubos.tech/anastasiia/global-variables-storevalue-2dm8"&gt;Global variables (storeValue)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1 - Creating a Tabs Widget
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Add a Tabs widget to your page.&lt;/li&gt;
&lt;li&gt;Create multiple tabs within the widget.&lt;/li&gt;
&lt;li&gt;Add some text content on each page to see the tab switching in action.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/2e94y57gg2qz3favg0o5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/2e94y57gg2qz3favg0o5.png" alt="Image description" width="1497" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 - Adding a Global Object
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;In the widget settings, go to the Events section and select "onTabSelected" for the event.&lt;/li&gt;
&lt;li&gt;Choose "storeValue" as the action in the event.&lt;/li&gt;
&lt;li&gt;Give a name to the global object by entering "selectedTab" in the "Key" field. Leave the "Value" field empty. This will ensure that our global object gets cleared when a tab is selected.&lt;/li&gt;
&lt;li&gt;In the "Selected tab" field, enter the reference to our global object.&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/n72c1sxb22gycsfcy43q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/n72c1sxb22gycsfcy43q.png" alt="Image description" width="795" height="714"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Turn off the "Show Tabs" enabled field. In this case, we hide the tab switcher.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 - Creating Tab Switching with Images
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Drag and drop the Image widget onto the page. In your case, you'll need four image widgets since you have four tabs.&lt;/li&gt;
&lt;li&gt;Insert any desired image URLs into the image widgets.&lt;/li&gt;
&lt;li&gt;In each image widget, go to the Events section.&lt;/li&gt;
&lt;li&gt;Select "storeValue" as the action.&lt;/li&gt;
&lt;li&gt;Give the name &lt;code&gt;selectedTab&lt;/code&gt; to our global object in the "Key" field.&lt;/li&gt;
&lt;li&gt;In the "Value" field, enter the name of the corresponding tab you want to open when the image is clicked.&lt;/li&gt;
&lt;li&gt;Repeat the above steps for each image widget, assigning the appropriate tab name to each image.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By following these steps for each image widget, clicking on an image will open the selected tab based on the value stored in the global object &lt;code&gt;selectedTab&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/jtag6u55uta9klmtf8q2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/jtag6u55uta9klmtf8q2.png" alt="Image description" width="881" height="724"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does it work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the Tab widget, we set the default value to reference our global object. By default, the global object is empty. However, when we click on an image, the state of our object changes to the name of the selected tab. As a result, the corresponding tab is switched, and its state is cleared.&lt;/p&gt;

&lt;p&gt;When the default state is empty, the Tab widget automatically opens the first tab. But when data (the name of our tab) is received, it opens the tab with the specified name. This is similar to loading a new page because the state is initially empty. After changing the tab, the state is cleared again, allowing us to repeat the process.&lt;/p&gt;

</description>
      <category>tabs</category>
    </item>
    <item>
      <title>Global Variables (storeValue)</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Wed, 21 Jun 2023 21:00:28 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/global-variables-storevalue-2dm8</link>
      <guid>https://community.ubos.tech/anastasiia/global-variables-storevalue-2dm8</guid>
      <description>&lt;p&gt;Global variables are useful because they are accessible on all pages. Their data is stored in the browser's LocalStorage, allowing them to be used for exchanging information both between all pages and within a single page.&lt;/p&gt;

&lt;p&gt;For example, let's create 3 widgets: 2 &lt;strong&gt;buttons&lt;/strong&gt; and 1 &lt;strong&gt;text&lt;/strong&gt; (to see what's inside the global object).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/8vdsastgiv3sryxzdtg1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/8vdsastgiv3sryxzdtg1.png" alt="Image description" width="766" height="744"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the "&lt;em&gt;Submit&lt;/em&gt;" button is clicked, we will create an object. We can add any type and amount of data to it. For this example, I will use the boolean (true/false) type.&lt;/p&gt;

&lt;p&gt;Let's create a global variable by calling the function &lt;code&gt;storeValue('name', {key: value})&lt;/code&gt;. The first parameter is a string that will serve as the name of the global variable, which we will use to refer to it. The second parameter is the value we want to store.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/589qk6srqeg4q8txbe32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/589qk6srqeg4q8txbe32.png" alt="Image description" width="651" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;button&lt;/code&gt; widget, on the &lt;code&gt;onClick&lt;/code&gt; event, we select JavaScript and write the code to store a variable named &lt;code&gt;example&lt;/code&gt; with a value of &lt;code&gt;true&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{storeValue('example', true)}}  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the button is clicked, a global variable will be created. To verify that it has been created successfully, we will display its value in the text widget. All global variables are stored in the &lt;code&gt;store&lt;/code&gt; object, which is located within the main variable.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/1b3owq6ubfnnfccrk9d0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/1b3owq6ubfnnfccrk9d0.png" alt="Image description" width="639" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To achieve this, we will write the following code in the text widget:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{main.store.example}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To overwrite the data of the global variable, we call &lt;code&gt;storeValue&lt;/code&gt; with the name of the variable we want to overwrite. We will write this code in the second button. Let's replace the value &lt;code&gt;true&lt;/code&gt; with &lt;code&gt;false&lt;/code&gt; and press the button to overwrite it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{storeValue('example', false)}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/7dcgxvbyuat4d1dgapjf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/7dcgxvbyuat4d1dgapjf.png" alt="Image description" width="705" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything stored in &lt;code&gt;storeValue&lt;/code&gt; is added to the Local Storage. If you open the DevTools in your browser and select Local Storage (usually found in the Application section), you will see the data that has been added.&lt;/p&gt;

&lt;p&gt;If you want to prevent Local Storage from persisting data when redirecting to other pages, you can pass &lt;code&gt;false&lt;/code&gt; as the third parameter in &lt;code&gt;storeValue&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;storeValue('name', value, false);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will ensure that the data is not stored in Local Storage when redirecting to other pages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;storeValue("name", {key: value}, false)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's worth noting that when the third parameter is set, it should be used for subsequent operations such as updating the value or deleting it. Otherwise, the variable will become inaccessible.&lt;/p&gt;

&lt;p&gt;To delete a variable from the object, you can assign it the value of "undefined":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;storeValue('name', undefined, false);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will effectively remove the variable from the object.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Working with FileManager (part 2)</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Wed, 07 Dec 2022 07:34:55 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/working-with-filemanager-part-2-2ho</link>
      <guid>https://community.ubos.tech/anastasiia/working-with-filemanager-part-2-2ho</guid>
      <description>&lt;p&gt;&lt;strong&gt;Необхідні умови:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Обліковий запис на UBOS&lt;/li&gt;
&lt;li&gt;Воркспейс UBOS&lt;/li&gt;
&lt;li&gt;UI Editor UBOS&lt;/li&gt;
&lt;li&gt;Flow Builder UBOS&lt;/li&gt;
&lt;li&gt;&lt;a href="https://community.ubos.tech/anastasiia/working-with-filemanager-part-1-4gb8"&gt;Реалізована перша частина&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Необхідні кроки:&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Отримання посилання на зображення
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/zwjtzdtok632canm2aqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/zwjtzdtok632canm2aqz.png" alt="Image description" width="1080" height="165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Файли, завантаження в сховище Node-red, можна використовувати для зовнішніх ресурсі, отримавши посилання. Реалізуємо для цього endpoint.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;В &lt;code&gt;http-in&lt;/code&gt; вибираємо метод GET та вказуємо шлях /img&lt;br&gt;
Сюди необіхідно буде передати параметр 'file' із назвою (шлях + назва, у випадку додаткових папок).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Функція &lt;code&gt;set msg.filename&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.filename = `/data/storage/${msg.payload.file}`
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Вузол &lt;code&gt;read file&lt;/code&gt; (node-red : file in):&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/btuf2cbvf15696i9anje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/btuf2cbvf15696i9anje.png" alt="Image description" width="1184" height="783"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Функція &lt;code&gt;set headers&lt;/code&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Для того, щоб побачити файл, в headers йому необхідно передати його тип. Більше про це можна дізнатись &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types" rel="noopener noreferrer"&gt;тут&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.headers = { 
    "content-type": "image/png", 
}
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Результат
Переходимо в середовище UI та додаємо віджет &lt;code&gt;image&lt;/code&gt;.
&lt;img src="https://community.ubos.tech/uploads/articles/qdbamwdwtd7jjoa5jfjw.png" alt="Image description" width="975" height="488"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Копіюємо посилання на Node-red для подальшого формування посилання.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/rnjvop4ts9cqopxwxbj4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/rnjvop4ts9cqopxwxbj4.png" alt="Image description" width="227" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;В налаштуваннях віджета &lt;code&gt;image&lt;/code&gt; формуємо посилання за формулою:&lt;br&gt;
&lt;code&gt;_NodeRedLink_/img?file=_filename_&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
В даному випадку, вставляємо значення, яке обрали із &lt;code&gt;FileManager&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/4uuywf4pntxj9n8er7ux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/4uuywf4pntxj9n8er7ux.png" alt="Image description" width="1596" height="691"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Це посилання можна використовувати не лише в UBOS, до прикладу відкриємо зображення в браузері: &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/fsy8wi7kl5itmffn0a62.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/fsy8wi7kl5itmffn0a62.png" alt="Image description" width="1626" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Редагування назви файлу
&lt;/h2&gt;

&lt;p&gt;Встановимо необхідні модулі:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flows.nodered.org/node/node-red-contrib-fs-ops" rel="noopener noreferrer"&gt;&lt;strong&gt;node-red-contrib-fs-ops&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/cy8249s4jmsrtw5s7lgf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/cy8249s4jmsrtw5s7lgf.png" alt="Image description" width="1274" height="578"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/f3swx6jmkp1ufmai4ttg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/f3swx6jmkp1ufmai4ttg.png" alt="Image description" width="1361" height="105"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;В &lt;code&gt;http-in&lt;/code&gt; вибираємо метод PUT, вказуємо шлях /fm/rename/image.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/mdju25h73cx9wej8429v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/mdju25h73cx9wej8429v.png" alt="Image description" width="822" height="472"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Функція &lt;code&gt;set path&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload.start = "/data/storage/"+msg.req.query.path;
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;У вузлі &lt;code&gt;fs-ops-move&lt;/code&gt; встановлюємо змінні, які за замовчуванням приходитимуть із UI:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/fkv9bucy3yf0dy9cwt4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/fkv9bucy3yf0dy9cwt4s.png" alt="Image description" width="1314" height="464"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Функція &lt;code&gt;set path&lt;/code&gt; - передаємо змінений шлях&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload.start = "/data/storage/"+msg.req.query.path;
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Вузол &lt;code&gt;File Lister&lt;/code&gt; - налаштування залишаються незмінними:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/tm5ik44pm0v9nu79k139.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/tm5ik44pm0v9nu79k139.png" alt="Image description" width="1183" height="751"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Вузол &lt;code&gt;set properties&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let result = {}; 

result.payload = msg.payload.map(elem=&amp;gt;{
    let patch;
    if(!elem.stat.isDirectory){
        patch = msg.req.query.path +"/"+elem.name;
    }else{
        patch = elem.name;
    }
    return{
        "isDirectory":elem.stat.isDirectory,
        "name":elem.name,
        "path":patch,
        "size":(elem.stat.size/1048576).toFixed(3) + "Мb",
        "editedAt":elem.stat.created,

    }
})

msg.payload = {
    success: true,
    payload: result
};
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Переходимо в середовище UI, обираємо файл та змінюємо назву:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/tqvckkn89rfwaxq6ruaz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/tqvckkn89rfwaxq6ruaz.png" alt="Image description" width="777" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Видалення файлів
&lt;/h2&gt;

&lt;p&gt;Встановимо необхідні модулі:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flows.nodered.org/node/node-red-contrib-loop-processing" rel="noopener noreferrer"&gt;*&lt;em&gt;node-red-contrib-loop-processing *&lt;/em&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/74g2j440v9hwwqrar1mu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/74g2j440v9hwwqrar1mu.png" alt="Image description" width="738" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/d2m0iqzl2dfcazrzurfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/d2m0iqzl2dfcazrzurfi.png" alt="Image description" width="1272" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;В &lt;code&gt;http-in&lt;/code&gt; вибираємо метод PUT, вказуємо шлях /fm/remove/image.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Вузол &lt;code&gt;counter-loop&lt;/code&gt;&lt;br&gt;
Оскільки є можливіть видалити масив елементів, використовуємо цикл, для їх перебору &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/x750mo99stzpx5w8x6u0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/x750mo99stzpx5w8x6u0.png" alt="Image description" width="992" height="545"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Тіло циклу:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Function&lt;/code&gt;
Для кожного елементу, який приходить в поточну ітерацію встановлюємо шлях:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.filename = "/data/storage/"+msg.req.query.path+"/"+msg.payload.payload[msg.index];

return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Вузол &lt;code&gt;delete&lt;/code&gt;
Передаємо сюди назву файлу та обираємо дію &lt;em&gt;delete file&lt;/em&gt;
&lt;img src="https://community.ubos.tech/uploads/articles/re2e06i786ejp1gmuip9.png" alt="Image description" width="759" height="316"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;По аналогії зі зміною назви, далі потрібно отримати нову структуру папки.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Функція &lt;code&gt;set path&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload.start = "/data/storage/"+msg.req.query.path;
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;File Lister:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/2smnde1b7c0mzpliewyi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/2smnde1b7c0mzpliewyi.png" alt="Image description" width="487" height="593"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Вузол &lt;code&gt;set properties&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let result ={};

result = msg.payload.map(elem=&amp;gt;{
    return{
        "isDirectory":elem.stat.isDirectory,
        "name":elem.name,
        "path":elem.name,
        "size":(elem.stat.size/1048576).toFixed(3) + "Мb",
        "editedAt":elem.stat.created,
    }
})

msg.payload = {
    success: true,
    payload: result
};

return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Додаткова інформація
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Завантажувати можна не лише зображення, а й файли із різним розширенням (.pdf, .doc, .xlsx, .csv, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Для отримання файлу із стору, необхідно змінили headers:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.headers = {
    "content-disposition": "inline",
    'content-Type': 'application/pdf',
    "charset": 'utf-8',
    "content-transfer-encoding": "binary"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Змінивши значення &lt;code&gt;"content-disposition": "attachment"&lt;/code&gt;, файл буде скачуватись.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Важливо!&lt;/strong&gt; Тимчасово назви ендпоінтів &lt;em&gt;/fm/upload/image, /fm/remove/image, /fm/rename/image&lt;/em&gt; - налаштування самого віджета, тому їх змінювати не можна, навіть якщо завантажуємо файл, а не зображення.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Working with FileManager (part 1)</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Sun, 20 Nov 2022 22:15:39 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/working-with-filemanager-part-1-4gb8</link>
      <guid>https://community.ubos.tech/anastasiia/working-with-filemanager-part-1-4gb8</guid>
      <description>&lt;h1&gt;
  
  
  Необхідні умови:
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Обліковий запис на UBOS&lt;/li&gt;
&lt;li&gt;Воркспейс UBOS&lt;/li&gt;
&lt;li&gt;UI Editor UBOS&lt;/li&gt;
&lt;li&gt;Flow Builder UBOS&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Необхідні кроки:
&lt;/h1&gt;

&lt;p&gt;Додати віджет &lt;code&gt;FileManager&lt;/code&gt;на робочу поверхню: &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/5lqnjo8erjxb7qlulbfx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/5lqnjo8erjxb7qlulbfx.png" alt="Image description" width="1872" height="743"&gt;&lt;/a&gt;&lt;br&gt;
А поле &lt;code&gt;API url&lt;/code&gt; додати посилання на створений flow builder(node-red), додавши символ &lt;em&gt;"/"&lt;/em&gt; в кінець, &lt;em&gt;Token = 1:&lt;/em&gt; &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/z2kr89fdmz7krcxt5o8j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/z2kr89fdmz7krcxt5o8j.png" alt="Image description" width="413" height="568"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;В node-red встановити модуль &lt;a href="https://flows.nodered.org/node/node-red-contrib-fs" rel="noopener noreferrer"&gt;&lt;strong&gt;node-red-contrib-fs&lt;/strong&gt;&lt;/a&gt; &lt;br&gt;
Для обміну файлами будемо використовувати вузол &lt;code&gt;fs-file-lister&lt;/code&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/vo4rb5pgvxv1n7oak6pf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/vo4rb5pgvxv1n7oak6pf.png" alt="Image description" width="861" height="486"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;FileManager&lt;/code&gt; дає можливість завантажувати не тільки зображення, а й файли та проектувати зручну структуру даних (папки, вкладені папки і тд.)&lt;/p&gt;

&lt;p&gt;Для початку просимулюємо відображення списку зображень із кореневої папки та додавання нових.&lt;/p&gt;

&lt;p&gt;В якості сховища використовуємо можливості node-red.&lt;/p&gt;

&lt;h2&gt;
  
  
  Відображення списку всіх файлів із storage
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/ztyqdm6nq06fffp6yprj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ztyqdm6nq06fffp6yprj.png" alt="Image description" width="1724" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;В &lt;code&gt;http-in&lt;/code&gt; вибираємо метод GET та вказуємо шлях /fm/list/image&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/7n4qcbftlsuwd9493qum.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/7n4qcbftlsuwd9493qum.png" alt="Image description" width="828" height="443"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;В наступному вузлі &lt;code&gt;function&lt;/code&gt;вказуємо шлях до папки, в якій зберігаються файли, та динамічну змінну &lt;em&gt;msg.payload.path&lt;/em&gt; - шлях та назва файлу, який ми отримуємо автоматично із UI editor.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload.start = "/data/storage" + msg.payload.path;
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Вузол &lt;code&gt;fs-file-lister&lt;/code&gt; - вказуємо початкові дані, які сформували раніше, та змінюємо значення в полях як показано тут:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/3fhg69jrzdqh2sqwo7ea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/3fhg69jrzdqh2sqwo7ea.png" alt="Image description" width="751" height="909"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;У другому вузлі &lt;code&gt;function&lt;/code&gt; після &lt;code&gt;fs-file-lister&lt;/code&gt; формуємо відповідь із інформацією про дані, які ми отримуємо із файлового сховища node-red за вказаним шляхом:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let result, patch; 
result = msg.payload.map(elem =&amp;gt; {
    if (!elem.stat.isDirectory) {
        patch = msg.req.query.path + "/" + elem.name;
    } else {
        patch = elem.name;
    }
    return {
        "isDirectory": elem.stat.isDirectory,
        "name": elem.name,
        "path": patch,
        "size": (elem.stat.size / 1048576).toFixed(3) + "Мb",
        "editedAt": elem.stat.created,
    }
})

msg.payload = {
    success: true,
    payload: result
};
return msg;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Додаємо вузол &lt;code&gt;http response&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Завантаження файлу в сховище
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/afsjhi2waofwz4kzt582.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/afsjhi2waofwz4kzt582.png" alt="Image description" width="1595" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;В &lt;code&gt;http-in&lt;/code&gt; вибираємо метод POST, вказуємо шлях /fm/upload/image та обираємо &lt;em&gt;Accept file uploads?&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/ufdp8nuym0s45m8g1la2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ufdp8nuym0s45m8g1la2.png" alt="Image description" width="711" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Далі у вузлі &lt;code&gt;function&lt;/code&gt; із даних, які отримуємо автоматично із UI editor, формуємо назву файлу &lt;em&gt;filename&lt;/em&gt;, записуємо буфер в змінну та передаємо цю інформацію далі.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.filename ="/data/storage/"+msg.req.query.path+"/"+ msg.req.files[0].originalname;

msg.payload.file = msg.req.files[0].buffer;
msg.payload = msg.payload.file;
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;З переліку вузлів обираємо &lt;code&gt;write file&lt;/code&gt;, який перетворює буфер у файл із заданою назвою та записує це в сховище.&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/q8f823e8b4x39bmvghuq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/q8f823e8b4x39bmvghuq.png" alt="Image description" width="1347" height="466"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Далі у &lt;code&gt;function&lt;/code&gt; задаємо шлях для filelister:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload.start = "/data/storage/"+msg.req.query.path;
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Наступні кроки за аналогією: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Вузол &lt;code&gt;fs-file-lister&lt;/code&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/55kmohq4xmmua6gdr4l0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/55kmohq4xmmua6gdr4l0.png" alt="Image description" width="761" height="797"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Останній &lt;code&gt;function&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let result, patch;
result = msg.payload.map(elem =&amp;gt; {
    if (!elem.stat.isDirectory) {
        patch = msg.req.query.path + "/" + elem.name;
    } else {
        patch = elem.name;
    }
    return {
        "isDirectory": elem.stat.isDirectory,
        "name": elem.name,
        "path": patch,
        "size": (elem.stat.size / 1048576).toFixed(3) + "Мb",
        "editedAt": elem.stat.created,
    }
})

msg.payload = {
    success: true,
    payload: result
};
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Додаємо вузол &lt;code&gt;http response&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Переходимо в &lt;code&gt;UI editor&lt;/code&gt; для завантаження: &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/gtwucyxh1e6cy972sytv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/gtwucyxh1e6cy972sytv.png" alt="Image description" width="553" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Після натискання кнопки Upload відкриється модальне вікно, де можна обрати зображення: &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/u9ck6hczr9q3u2vfg3vk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/u9ck6hczr9q3u2vfg3vk.png" alt="Image description" width="657" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Результат:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/p1ou8xtby02ytuuhlbnb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/p1ou8xtby02ytuuhlbnb.png" alt="Image description" width="1170" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating a functional widget</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Tue, 26 Jul 2022 21:34:33 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/creating-a-functional-widget-1eo9</link>
      <guid>https://community.ubos.tech/anastasiia/creating-a-functional-widget-1eo9</guid>
      <description>&lt;p&gt;Необхідні умови:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;UI Editor UBOS&lt;/li&gt;
&lt;li&gt;Flow Builder UBOS&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/ljhbaewvy51yez6j9qnx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ljhbaewvy51yez6j9qnx.png" alt="Image description" width="244" height="195"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Функціональний (function)&lt;/code&gt; віджет може відображатись на всіх сторінках, тому його часто використовують в якості &lt;em&gt;header&lt;/em&gt; та &lt;em&gt;sidebar&lt;/em&gt;. Віджет можна створювати та редагувати на будь-якій сторінці (важливо виділити під нього простір на кожній, щоб не виникало конфліктів при накладанні контейнерів). За необхідності в налаштуваннях функціонального віджету (бічна панель справа) можна додати сторінки на яких його не буде: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/cl9ldq5h8k617f5xqrj7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/cl9ldq5h8k617f5xqrj7.png" alt="Image description" width="320" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Розглянемо принципи роботи функціонального віджету на прикладі бічної панелі з навігаційним меню та хедеру. &lt;/p&gt;

&lt;h2&gt;
  
  
  Створення sidebar.
&lt;/h2&gt;

&lt;p&gt;На сторінці home page pозміщуємо віджет &lt;code&gt;Function&lt;/code&gt;, в середину поміщаємо &lt;code&gt;ButtonsGroup&lt;/code&gt;: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/6oht120iem4xutvot54y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/6oht120iem4xutvot54y.png" alt="Image description" width="614" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Відповідно для кожної сторінки, яку потрібно додати в меню, створюємо кнопку з такою ж назвою.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/7ike4vnfz0guaw4ot2wc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/7ike4vnfz0guaw4ot2wc.png" alt="Image description" width="936" height="542"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;У випадку, якщо декілька сторінок потрібно об'єднати в один модуль та створити підменю, достатньо відкрити налаштування кнопки, змінити &lt;code&gt;"Button type"&lt;/code&gt; на &lt;code&gt;"Menu"&lt;/code&gt;та в полі &lt;code&gt;"Menu Items"&lt;/code&gt; додати потрібні елементи:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/onaxwptma77eqwt47in3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/onaxwptma77eqwt47in3.png" alt="Image description" width="834" height="703"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Тепер залишилось зробити їх функціональними. Для цього в налаштуванні кожної кнопки додаємо перехід на сторінку при натисканні. В полі "&lt;code&gt;onClick&lt;/code&gt;" обраємо функцію "&lt;code&gt;Navigate to&lt;/code&gt;" та вказуємо необхідну назву або додаємо код власноруч, натиснувши "JS":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{navigateTo('PageName', {})}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/orjkdq1onn27tzn9bx7b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/orjkdq1onn27tzn9bx7b.png" alt="Image description" width="442" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Створення header.
&lt;/h2&gt;

&lt;p&gt;Додаємо віджет &lt;code&gt;Function&lt;/code&gt;, в середині якого буде відображатись назва поточної сторінки в полі віджету &lt;code&gt;Text&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/5kmdawkl5ce9njd4c6yr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/5kmdawkl5ce9njd4c6yr.png" alt="Image description" width="1178" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Для цього повертаємось до меню. При натисканні на кнопку буде виконуватись дві функції: перехід та запис назви в глобальну змінну, доступ до якої також є на кожній сторінці.&lt;/p&gt;

&lt;p&gt;В налаштуваннях кнопки в полі &lt;code&gt;onClick&lt;/code&gt;, натискаємо "JS", до існуючого коду додаємо функцію &lt;code&gt;storeValue&lt;/code&gt;, яка записуватиме назву сторінки в значення змінної &lt;code&gt;page&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{navigateTo('Page Name', {});storeValue("page","Page Name")}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Залишилось вивести це в хедер. Натискаємо на текстовий віджет та додаємо в поле &lt;code&gt;Text&lt;/code&gt; динамічне значення змінної із store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{appsmith.store.page}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/229grbswip8gda8vo9fp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/229grbswip8gda8vo9fp.png" alt="Image description" width="781" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Результат:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/ed199kzyd5flhfhshzly.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/ed199kzyd5flhfhshzly.png" alt="Image description" width="1414" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to view the elements of Database collection?</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Thu, 14 Jul 2022 07:21:37 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/how-to-view-the-elements-of-database-collection-4dn5</link>
      <guid>https://community.ubos.tech/anastasiia/how-to-view-the-elements-of-database-collection-4dn5</guid>
      <description>&lt;p&gt;Необхідні умови:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;UI editor UBOS&lt;/li&gt;
&lt;li&gt;Flow Builder UBOS&lt;/li&gt;
&lt;li&gt;Не пуста колекція MongoDB &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Після того, як було створено нову колекцію, виникає необхідність переглянути всі елементи чи декілька з певним значенням поля. Для цього можна встановити та налаштувати &lt;a href="https://www.mongodb.com/products/compass" rel="noopener noreferrer"&gt;MongoDB Compass&lt;/a&gt;, але є кращий та швидший варіант, використовуючи Node-Red.&lt;/p&gt;

&lt;p&gt;Покажемо це на прикладі колекції із даними про погоду протягом 5-ти днів: &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/w5bfg9h8o2z9dxyb53lq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/w5bfg9h8o2z9dxyb53lq.png" alt="Image description" width="1466" height="464"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Відображення всіх елементів колекції
&lt;/h3&gt;

&lt;p&gt;Для цього використаємо &lt;code&gt;inject&lt;/code&gt;, щоб звернутись до бази даних вказану у вузлі &lt;code&gt;mongodb in&lt;/code&gt; та &lt;code&gt;debug&lt;/code&gt;, щоб побачити результат:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/pyixb675ch07jsqk9fe3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/pyixb675ch07jsqk9fe3.png" alt="Image description" width="526" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Створюємо endpoint:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/dqgc5h81lpbc69je74ez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/dqgc5h81lpbc69je74ez.png" alt="Image description" width="1129" height="137"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;У вузлі &lt;code&gt;mongodb in&lt;/code&gt; з назвою "weatherDB" &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;обираємо базу даних, &lt;/li&gt;
&lt;li&gt;вказуємо потрібну колекцію,&lt;/li&gt;
&lt;li&gt;обираємо операцію "find".
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/scul4rtd2ck0kvek1wpu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/scul4rtd2ck0kvek1wpu.png" alt="Image description" width="853" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Після цього залишилось запустити endpoint, натиснувши кнопку на вузлі &lt;code&gt;inject&lt;/code&gt; (timestamp - це параметр вузла за замовчуванням): &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/qoreawp1t0q1h6ml1t71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/qoreawp1t0q1h6ml1t71.png" alt="Image description" width="920" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;В меню праворуч, відкривши поле &lt;code&gt;debug&lt;/code&gt;, можна побачити елементи колекції:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/zo1xxs4sw45iyxjeam6t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/zo1xxs4sw45iyxjeam6t.png" alt="Image description" width="995" height="835"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Фільтрація елементів.
&lt;/h3&gt;

&lt;p&gt;Уявимо, що потрібно знайти всі дні коли, погода була сонячною. Для цього потрібно додати вузол &lt;code&gt;function&lt;/code&gt; і в msg.payload відповідну пару ключ-значення:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload={
    description: "Sunny"
}
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/dsk0d6d8kybqvyy8pk8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/dsk0d6d8kybqvyy8pk8g.png" alt="Image description" width="1081" height="333"&gt;&lt;/a&gt; &lt;br&gt;
Можна фільтрувати за декількома значеннями:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload={
    description: "Sunny",
    day: "Wednesday"
}
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/8zetlamygodmzhthsjej.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/8zetlamygodmzhthsjej.png" alt="Image description" width="1564" height="275"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Сортування елементів.
&lt;/h3&gt;

&lt;p&gt;Для сортування елементів використовують оператор &lt;a href="https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/" rel="noopener noreferrer"&gt;&lt;em&gt;$sort&lt;/em&gt;&lt;/a&gt; та операцію &lt;a href="https://www.mongodb.com/docs/manual/aggregation/" rel="noopener noreferrer"&gt;&lt;em&gt;aggregate&lt;/em&gt;&lt;/a&gt;. Для прикладу відсортуємо дні в порядку зростання температури:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload={
    $sort:{
        temperature: 1
    }
}
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/awzlbgute4dmi8lnubk4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/awzlbgute4dmi8lnubk4.png" alt="Image description" width="1397" height="545"&gt;&lt;/a&gt;&lt;br&gt;
Результат:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/6tozveonbz902pz30xgk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/6tozveonbz902pz30xgk.png" alt="Image description" width="395" height="898"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Вивід даних в таблицю.
&lt;/h3&gt;

&lt;p&gt;Вміст колекції БД також можна відобразити в &lt;code&gt;UI&lt;/code&gt; частині. Спершу до endpoint в Node-Red необхідно додати вузол &lt;code&gt;http in&lt;/code&gt; із URL "/getWeater": &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/5db0g29qsy709qbxytc8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/5db0g29qsy709qbxytc8.png" alt="Image description" width="1545" height="206"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/pd3kfccjwabyv4s2thoo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/pd3kfccjwabyv4s2thoo.png" alt="Image description" width="514" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Для виконання запиту до бази даних в &lt;code&gt;UI Editor&lt;/code&gt; потрібно створити API call із методом GET та URL потрібного endpoint. URL складається із посилання на Node-Red та endpoint:  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/5gk5mso6dp2a4ljeu4d5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/5gk5mso6dp2a4ljeu4d5.png" alt="Image description" width="1666" height="549"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Посилання на Node-Red можна отримати в лівому меню:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/m1tpgkxzdxdxc79ydlt8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/m1tpgkxzdxdxc79ydlt8.png" alt="Image description" width="623" height="657"&gt;&lt;/a&gt;&lt;br&gt;
Після виклику API на кнопку &lt;code&gt;RUN&lt;/code&gt; переходимо на сторінку та створюємо таблицю (віджет Table), в полі Table Data вказуємо &lt;code&gt;{{getWeather.data}}&lt;/code&gt;:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/3muib15n6s5mfgltpkpl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/3muib15n6s5mfgltpkpl.png" alt="Image description" width="1413" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Synchronization with three services via Node-red:</title>
      <dc:creator>AC</dc:creator>
      <pubDate>Fri, 01 Jul 2022 07:34:30 +0000</pubDate>
      <link>https://community.ubos.tech/anastasiia/synchronization-with-three-services-via-node-red-2f59</link>
      <guid>https://community.ubos.tech/anastasiia/synchronization-with-three-services-via-node-red-2f59</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Синхронізація з трьома сервісами через Node-red:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Необхідні умови:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Воркспейс UBOS&lt;/li&gt;
&lt;li&gt;Flow Builder UBOS&lt;/li&gt;
&lt;li&gt;Обліковий запис в Telegram&lt;/li&gt;
&lt;li&gt;Обліковий запис в AirTable&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;За допомогою середовища Node-red можна реалізувати налаштування чат-бота для Telegram, беручи команди із таблиці AirTable, та відправлення повідомлень з чату на вказану пошту.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Telegram&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Про те як створити телеграм бота та прив'язати його до Node-red можна дізнатись &lt;a href="https://community.ubos.tech/yk/iak-stvoriti-bazovogho-telegram-bota-ta-intieghruvati-z-nodered-5ej6"&gt;в статті.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;AirTable.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Створюємо таблицю в &lt;a href="https://airtable.com/" rel="noopener noreferrer"&gt;AirTable&lt;/a&gt; з двома колонками: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Command&lt;/em&gt;: команди для Telegram-Bot,&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Answer&lt;/em&gt;: відповіді на ці команди.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/9uiijyr3s7sivnrl80va.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/9uiijyr3s7sivnrl80va.png" alt="Image description" width="1504" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Зверніть увагу на назву таблиці &lt;strong&gt;TableName&lt;/strong&gt; зліва та назви колонок.&lt;/p&gt;

&lt;p&gt;Для зв’язку з таблицею Tasks в середовищі Node-red будемо використовувати вузол &lt;code&gt;http request&lt;/code&gt;, який назвемо AirTable request . &lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/72009beyovmjkal0547h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/72009beyovmjkal0547h.png" alt="Image description" width="340" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;URL (AirTable API) можна утворити за такою схемою:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.airtable.com/v0/BaseID/TableName?api_key=APIkey
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;BaseID&lt;/strong&gt; та &lt;strong&gt;APIkey&lt;/strong&gt; можна  знайти в &lt;a href="https://airtable.com/api" rel="noopener noreferrer"&gt;документації API&lt;/a&gt;. TableName - назва таблиці.&lt;/p&gt;

&lt;p&gt;У розділі "INTRODUCTION" знаходимо BaseID:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/qx9rmf97mg0vm011pet2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/qx9rmf97mg0vm011pet2.png" alt="Image description" width="880" height="545"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;У розділі "AUTHENTICATION" переходимо за посиланням на сторінку аккаунту, там знаходимо APIkey:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/p9f8u5lpf773yrzmw837.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/p9f8u5lpf773yrzmw837.png" alt="Image description" width="1304" height="1296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Отримане посилання вставляємо в поле URL вузла &lt;code&gt;http request&lt;/code&gt;: AirTable request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.airtable.com/v0/app5nGk...nNyZY/Tasks?api_key=keyui...nglSeh2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/dl5jqmqtxpxmh8j58we4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/dl5jqmqtxpxmh8j58we4.png" alt="Image description" width="880" height="362"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Щоб побачити дані, які повертаються після запиту до таблиці, підключимо до AirTable request вузли &lt;code&gt;debug&lt;/code&gt; та &lt;code&gt;inject&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/9lr7wps3kz6t9l01sijy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/9lr7wps3kz6t9l01sijy.png" alt="Image description" width="841" height="578"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Відправлення email на пошту.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Використовуємо вузол &lt;code&gt;sendgrid&lt;/code&gt; із бібліотеки &lt;a href="https://flows.nodered.org/node/node-red-contrib-sendgrid" rel="noopener noreferrer"&gt;node-red-contrib-sendgrid&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/kk63jwdq0815unb4r965.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/kk63jwdq0815unb4r965.png" alt="Image description" width="236" height="103"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Api key:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SG.4zAEY3xh***********************************
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/xdjn5nkdxzgvybderxc0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/xdjn5nkdxzgvybderxc0.png" alt="Image description" width="569" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Створення endpoint.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Використовуємо вузли:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;receiver&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sender&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;http request&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;&lt;code&gt;sendgrid&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;4 function&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/mwmob9o9jyobhdvztgh3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/mwmob9o9jyobhdvztgh3.png" alt="Image description" width="1296" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Залишилось розібратись із 4 function: &lt;code&gt;saveTelegram&lt;/code&gt;, &lt;code&gt;getCommand&lt;/code&gt;, &lt;code&gt;sendAnswer&lt;/code&gt;, &lt;code&gt;sendEmail&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;У вузлі &lt;code&gt;saveTelegram&lt;/code&gt; треба створити змінну &lt;em&gt;telegramMessage&lt;/em&gt; та присвоїти їй значення отриманого повідомлення із чат-боту.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.telegramMessage = msg.payload
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/wcx54e73oalxhiprk8wv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/wcx54e73oalxhiprk8wv.png" alt="Image description" width="880" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;У &lt;code&gt;getCommand&lt;/code&gt; отримані дані з AirTable необхідно спершу перетворити строку на об'єкт, відфільтрувати масив records та витягнути лише одну пару команда-відповідь, яка була написана в чат-бот.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload = JSON.parse(msg.payload);
msg.payload = msg.payload.records.map(e=&amp;gt; e.fields)
msg.payload = msg.payload.filter(e=&amp;gt; e.Command == msg.telegramMessage.content)
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/nscedrinyjx1wszlr6sc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/nscedrinyjx1wszlr6sc.png" alt="Image description" width="880" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;В &lt;code&gt;sendAnswer&lt;/code&gt; формуємо відповідь на команду.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;msg.payload = {
    ...msg.telegramMessage,
    content: msg.payload[0].Answer
}
return msg;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://community.ubos.tech/uploads/articles/kudq2v1n28rmwvadj92k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/kudq2v1n28rmwvadj92k.png" alt="Image description" width="880" height="384"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;У вузлі &lt;code&gt;sendEmail&lt;/code&gt; потрібно вказати topic листа та його вміст. Якщо була викликана команда "/sendEmail" повідомлення буде надісланим.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (msg.telegramMessage.content == "/sendEmail"){
    msg.topic = "Msg from my telegramBot"
    msg.payload = msg.payload.content
    return msg;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Результат.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Telegram-chat:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/03oohoj4rdxgpgd5n3j1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/03oohoj4rdxgpgd5n3j1.png" alt="Image description" width="495" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Email:&lt;br&gt;
&lt;a href="https://community.ubos.tech/uploads/articles/v5p0p6bvn5uf22m2ml37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://community.ubos.tech/uploads/articles/v5p0p6bvn5uf22m2ml37.png" alt="Image description" width="515" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
