Prowl agent

hello there trying to finish up the prowl agent.
It is almost done, i only have one question, but first here is my code:


// prowl Agent
const crowl_API_KEY = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
local prowl_title = “TEST”;
function send_prowl(body) {
local prowl_url = “” + crowl_API_KEY + “&application=” + prowl_title + “&event=” + body; //setup url
server.log("Prowl URL: " + prowl_url);
server.log("Prowl data send: " + body); //pring body for testing
local req =, {“Content-Type”:"application/x-www-form-urlencoded "}, body); //add headers
local res = req.sendsync(); //send request
if(res.statuscode != 200) {
server.log("error sending message: “+res.body);
}else device.send(“status”, (res.statuscode + " OK”)); //sends status

device.on("prowl", function(body) {       //take from device
send_prowl(body);         //send to function to call prowl



agent.send(“prowl”, “hello world” ); //send string to agent

So 2 questions please.

The example is supposed to send hello world. But i only get hello. Basically anything after first space is not displayed.
Is there any way this can be fixed?

Also , how could i send
agent.send(“prowl”, “hello world” ); //send string to agent

but also include the prowl_title as well instead of it being hardcoded on the agent?

Thanks in advance and i hope this code helps others too!

You should be able to call agent.send with a table as the data… something like this:

`// device code:
agent.send(“prowl”, { prowl_title = “prowl title”, prowl_body = “hello world” });

// agent code
function send_prowl(title, body) {

device.on(“prowl”, function(data) {
send_prowl(data.prowl_title, data.prowl_body);

Thanks! That works… the only thing that doesnt work are the spaces in between though. So from your example this will work:
agent.send(“prowl”, { prowl_title = “prowl_title”, prowl_body = “hello_world”});

but not this one:

agent.send(“prowl”, { prowl_title = “prowl title”, prowl_body = “hello world”});

any ideas?
thanks again

i know for sure i can send the message with spaces too. i have a php example that lets you do it. also if i use the address bar on the browser i can send: title&event=Activated from WWW and it will send the spaces as well…

i found it… for any body else that was trying it out, all i needed to do is to add both messages in here so instead of:

local req =, {“Content-Type”:"application/x-www-form-urlencoded "}, body); //add headers

we should have:

local req =, {“Content-Type”:"application/x-www-form-urlencoded "}, “&application=” + title + “&event=” + body); //add headers

and leave local prowl_url = “” + crowl_API_KEY; //setup url without the “&application=” + title + “&event=” + body

It would be a good idea to use an “agent snippet” thread and everybody posts their agents verified they work!
thanks again for the help

That still won’t work with titles or bodies with “=” or “&” in the names. You need to look into http.urlencode().


thanks Peter, i will try these as well!