Skip to main content

How to create a Blockly serverless function

You can get access to our Blockly feature by choosing blockly in the programming languages dropdown.

Blockly is a visual programming editor developed by Google, using drag-and-drop blocks to represent code concepts. It powers many popular coding education programs and IoT projects.

Demoโ€‹

Here's our latest demo showing how you can create a low-code serverless function using Blockly editor.

demo_blockly

When you select Blockly as the programming language, the editor turns into a low-code editor (also called Blockly workspace) where you can drag and drop blocks to build your function logic. You can always switch to the code mode to see the generated Python code.

By default, You will find in the Blockly workspace the handle block returning an empty string. This block is the entry point of your function, and you can add more blocks to it to build your logic.

blockly_workspace

In the sidebar, you will find the block palette with different categories of blocks. You can drag and drop blocks from the palette to the workspace to build your function logic.

  • Logic: contains blocks for logical operations like conditions, comparisons, and more. You can use these blocks to control the flow of your function.

blockly_workspace

  • Loop: ontains blocks for loops, allowing you to repeat actions multiple times. You can use these blocks to iterate over lists or perform actions until a condition is met.

blockly_workspace

  • Math: contains blocks for mathematical operations like addition, subtraction, multiplication, division, and more. You can use these blocks to perform calculations in your function.

blockly_workspace

  • Text: contains blocks for working with text, allowing you to create and manipulate strings. You can use these blocks to format messages or handle text data.

blockly_workspace

  • Lists: contains blocks for creating and manipulating lists (arrays). You can use these blocks to store and manage collections of data.

blockly_workspace

  • Variables: contains blocks for creating and using variables. You can use these blocks to store and retrieve data in your function.

blockly_workspace

  • Environment: currently contain one block to call a environment variable, you already created in your function.

blockly_workspace

  • Functions: contains blocks for creating and calling custom functions. You can choose the standard function, or choose ones with no return value, with async keyword, and call a function you created in your code.

blockly_workspace

  • HTTP: contains blocks for making HTTP requests, allowing you to interact with external APIs or services. You can use these blocks to send and receive data over the web.

blockly_workspace

  • JSON: contains blocks for working with JSON data, allowing you to parse and manipulate JSON objects. You can use these blocks to handle structured data in your function.

blockly_workspace

  • Faas: contains blocks for interacting with the FaaS engine, allowing you to call already created functions and set or call arguments.

blockly_workspace

  • AI: this category only available for EE edition, contains blocks for interacting with AI services, allowing you to send and receive data from AI models. You can use these blocks to integrate AI capabilities into your function.

blockly_workspace

  • KV Storage: contains blocks for interacting with KV storage, allowing you to create, get, update, and delete key-value pairs. You can use these blocks to store and retrieve data in your function (You can learn more about the KV storage feature from here).

blockly_workspace

  • Notifications: contains blocks for sending notifications via email, webhooks (Slack, and Discord), and bot tokens (Slack, Discord, and Telegram). You can use these blocks to send messages or alerts from your function. Good to use for IoT projects.

blockly_workspace