HTTP In to OpenRPA

Hi all. I wrote a Python script which sends data to nodeRED. I can see the data in debug mode but when I run the bot and use “write line” there’s no output. Window says bot ran successfully. Any way I can send the data to a bot?

I get the debug output when I run the python script.

nodeRED debug showing data which I sent via API:


.
.
.
.
OpenRPA activity (I’m not sure if I have to invoke an openflow workflow or not):
image

writeline sends data to the output tab in the robot, it has nothing to do with nodered.
Nodered send/get arguments of the workflow

@Quamrul_Zabedin
In Nod-RED, data is always transmitted in a “payload” object. The remaining parameters are passed in other objects or keys.

Try passing your value in the following format:

{
    "payload":
    {
        "menuvalue": "banana"
    }
}

@Velinkton i think that is how it already is, based on the screenshot.
But i think i could be more clear in my last post.

Think of a openrpa workflow as a function. The argument tab is the parameters of the function, and when you call that function from nodered, we map each property on msg.payload to the corresponding argument on the workflow. So in your case you need to add an argument called menuvalue … you can set it as in/out … inside your workflow do a writeline of menuvalue and then add an “assign” activity and change the value of menuvalue … then you can see the change in your debug node inside nodered )

2 Likes

Since you are working with python, i also want to mention you can “bypass” NodeRED and send message directly to OpenRPA from python.
If you pip install openiap then you can send a message to a robot by using the _id of the user that is logged into the robot using QueueMessage

So something similar to this

import openiap, asyncio
from openiap import Client
        
async def tmpqueue(client: openiap.Client, msg, payload: dict):
    print(("dummy"))
async def main():
    cli = openiap.Client()
    await cli.Signin()
    await cli.RegisterQueue("", tmpqueue) # Register a temp queue, for responses
    payload = {
        "command": "invoke",
        "workflowid": "5e0b52194f910e30ce9e3e49", # _id of the openrpa workflow run execute
        "data": {
            "payload": { # test must be added as a argument on the argument tab of the workflow in openrpa, as in/out
                "test": "find me"
            }
        }
    }
    # Send invoke command to the robot ( queuename is _id of the user the robot is running as )
    result = await cli.QueueMessage(queuename="5e0c8a75ea7ae0004e415e27", payload= payload, rpc=True)
    print(result["data"])
    cli.Close()
asyncio.run(main())

image

1 Like

Thank you so much for the help, Allan! I was able to get my results properly. This works! :smiley:

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.