ZooeyBot icon indicating copy to clipboard operation
ZooeyBot copied to clipboard

About OnAlertCallbackCommand

Open DarkHorse1121 opened this issue 5 years ago • 16 comments

Would you let me know the format for "OnAlertCallbackCommand"?

When I describe as below, command execution was failed.

OnAlertCallbackCommand=curl -X POST -H "Authorization: Bearer ASSESS_TOKEN" -F "message=Warning! from PC" https://notify-api.line.me/api/notify

Already confirmed on command prompt.

DarkHorse1121 avatar Jul 22 '19 13:07 DarkHorse1121

Hi, Could it be that your token expired?

Masuzu avatar Jul 22 '19 16:07 Masuzu

@Masuzu Not expired. I got token yesterday and confirmed execution and notified to my phone. I checked by windows command prompt window.

Thanks,

DarkHorse1121 avatar Jul 22 '19 21:07 DarkHorse1121

Does anyone use this feature and working? If so, would you introduce command format summary? OnAlertCallbackCommand=[ your code ]

DarkHorse1121 avatar Jul 23 '19 07:07 DarkHorse1121

What is the exact error? A curl could be not found error?

Masuzu avatar Jul 23 '19 10:07 Masuzu

@Masuzu How do you test the command?

Also, does this look correct to you?

OnAlertCallbackCommand=curl -XPOST -d "token=<>" -d "channel=#general" -d "text=Hello @username" -d "username=token" "https://slack.com/api/chat.postMessage"

0gawdn0 avatar Jul 23 '19 10:07 0gawdn0

That looks correct. I will go and grab a test token from slack then to try and reproduce the error. I ran a python script on my side, that script handling the service API logic.

Masuzu avatar Jul 23 '19 12:07 Masuzu

Will there be a turtorial about how to use the call back alert system?

GBFUSER1993 avatar Jul 31 '19 08:07 GBFUSER1993

No time right now, but that'd be helpful.

Masuzu avatar Aug 01 '19 14:08 Masuzu

If anyone wants to know how to formulate the command to receive a notification on discord from a webhook bot, i use the following curl -X POST -d "{\"content\":\""<@yournameid>" \"}" yourwebhookurl

Vatar avatar Aug 01 '19 17:08 Vatar

On a computer that is running a 64-bit version of Windows , a 32-bit application cannot access the following folder: %WinDir%\System32

When a 32-bit application tries to access the System32 folder, access is redirected to the following folder: %WinDir%\SysWOW64

As a walk-around solution, 32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32.

So, if we want to access C:\Windows\System32\curl.exe from 32-bit application, we can use C:\Windows\Sysnative\curl.exe instead.

Try describing as below.

OnAlertCallbackCommand=C:\Windows\Sysnative\curl.exe -X POST -H "Authorization: Bearer ASSESS_TOKEN" -F "message=Warning! from PC" https://notify-api.line.me/api/notify

Singapura310 avatar Aug 02 '19 02:08 Singapura310

@Singapura310 Thanks for your comments. As per "C:\Windows\Sysnative", I can't find in my Windows and you means "C:\Windows\System32"?

I'll try.

DarkHorse1121 avatar Aug 02 '19 14:08 DarkHorse1121

The Sysnative is a virtual directory not a real one.

Singapura310 avatar Aug 03 '19 02:08 Singapura310

@Vatar Hey, I really appreciate that! Just wondering, does mine look right?

curl -X POST -d "{"content":""<@Username#0000>" "}" webhook url

Do you know any way of testing it?

0gawdn0 avatar Aug 03 '19 12:08 0gawdn0

I tried with following command but still failed.

OnAlertCallbackCommand=C:\Windows\System32\curl -X POST -H "Authorization: Bearer <TOKEN>" -F "message=Warning! from PC" https://notify-api.line.me/api/notify

DarkHorse1121 avatar Aug 03 '19 13:08 DarkHorse1121

@DarkHorse1121

On a 64-bit Windows, ZooeyBot cannot access C:\Windows\System32 because of a file system redirector.

Use Sysnative instead.

Incorrect: OnAlertCallbackCommand=C:\Windows\System32\curl ... Correct: OnAlertCallbackCommand=C:\Windows\Sysnative\curl ...

Singapura310 avatar Aug 03 '19 14:08 Singapura310

@Vatar Hey, I really appreciate that! Just wondering, does mine look right?

curl -X POST -d "{"content":""<@Username#0000>" "}" webhook url

Do you know any way of testing it?

Just open up a terminal(right-click windows at bottom-left->terminal), copy-paste and try to execute it.

Zoeey will do just that.

Vatar avatar Aug 12 '19 11:08 Vatar