Technical Explanation ===================== What is WebAssembly? -------------------- WebAssembly (WASM) is a binary instruction format based on a stack-based virtual machine, designed as a portable target for high-level languages such as C, C++, and Rust. It enables deployment in both client-side and server-side applications. For more details, refer to the official WebAssembly documentation https://webassembly.org/docs/faq/. Creating Custom WASM Files -------------------------- 1. Write Code: Develop backend task logic in your preferred programming language. 2. Compile to WASM: Compile your code into a WASM file. Examples for Python and C: - Python: Use py2wasm to compile Python code into WASM. - C: Use Emscripten to compile C code into WASM. 3. Upload to MailTrigger: Upload the compiled WASM file to the MailTrigger system and set the execution interval (in seconds). Sample Program ---------------------------- Below is a simple example program demonstrating how to make http requests in Python and compile it into WebAssembly format: :: # example.py import json # Get the current task information from the workspace's input.json with open("./input.json", "r", encoding="utf8") as f: input = json.loads(f.read()) mailboxId = input["mailboxId"] taskId = input["taskId"] # Write the parameters for executing the request with open("/requests/get.txt", "w", encoding="utf8") as f: config = json.dumps( { "url": "https://jsonplaceholder.typicode.com/posts/1" } ) f.write(config) # Actually execute the request and get the response with open("/requests/response.txt", "r", encoding="utf8") as f: response = f.read() After compiling the above program into WebAssembly format, it can be uploaded and used within the MailTrigger system.