Using python Node In Interplay

Written By Chetan Iterate (Administrator)

Updated at January 5th, 2021

 Until now we have exclusively used JavaScript for creating Node, we wonder that can we use other languages other than JavaScript?

Surprise surprise! We can use Python and Python 3 for our tasks with python rules for syntax, function and data types.

But first, we have to understand the properties and mechanism of working with nodes, A Node always have these two properties.

__msgid: This property denotes the unique identification of a node in flow, Every node always has __msgid property.

payload: This property always consists of the data which are commonly shared between nodes, every node and its function. it consists only of the JSON object and can be displayed using a simple console.

Let's make a flow using a python.

Steps 

1 ) Search and drag-and-drop 'inject' node in workflow This time we inject a string.



2 ) Now edit the inject node as below.



3 ) Now drag-and-drop the python 3 function Node and Double click on it to edit its properties.



Note: for python 3 Here Inject node injects the payload in the given python function, so by itself it passed the given string under the name 'payload' for using the injected string such as 'variable_name['payload']'.

4 ) Now search for node 'console' module for console output, drag to the workflow and it will automatically rename itself so what it should be assigned for Edit the properties as follows.

5 ) Now the flow is complete, click on Deploy To see the effect, click on. to reveal the current status of the flow, now click on. to see the debug message, the output is like this.

Yess! can Now Celebrate! you have created your first flow with Python 3 Code!

Was this article helpful?