Skip to main content

Python Brick

PurposeLearn about the various configurations and parameters required for the Python Brick to function correctly.
Last updatedAugust 02, 2024

What is a Python Brick?

Python Bricks belong to the Execute Bricks. These bricks are made to run specific Python scripts, so that users can take advantage of all the functions and libraries that Python has to offer for a great number of operations. Introducing Python Bricks into a certain process enables users to develop sophisticated and versatile automation procedures that can handle various data manipulations, calculations, and interfacing with other systems.


Python Brick configuration supporting video


Python Brick Parameters

  1. Label: This is where the user can provide a name for the brick.

  2. Python Code: In this section the user will provide the desired task that the brick will execute. For this brick to work a do function is needed and will be expected.

    • do function example:
      def do(event, python):


    • Function Name and Parameters:
      • do is the name of the function.
      • event and python are the parameters of the function. They represent the data that will be passed to the function when it is called.

For more information on VRL syntax follow links below:

Learn more about VRL


Python Brick output format

In this section of the documentation the user will learn where are the outputs of the brick stored and its format.

The output variables may vary depending on the input brick providing the data, here are some examples:

  1. Name of variable: python
    • Format:
      • downloads (List): A list of downloaded records.
      • contextInfo (Dictionary): Contains information about the context of the conversation.
      • direction (String): Indicates the direction of the message, e.g., "received".
      • from (Dictionary): Contains details about the sender of the message.
      • message (Dictionary): Contains details about the message.
      • timestamp (Integer): The timestamp of the message.
      • to (String): The unique identifier (JID) of the recipient.
      • type (String): Indicates the type of the outer structure, e.g., "message".
      • version (Integer): The version of the message structure.