Notification from RPA by LINE
My Cloud Computer has recently become an RPA dedicated execution machine called Sikulix, and it runs more comfortably and crisply than my home computer (my personal opinion). After all, it is physically located in a data center, which is (probably) closer network-wise to the target access server, and best of all, it is not affected by the congestion and failures of service providers. Even I don't do stock or crypto assetes at all, but I imagine that the popularity of cloud use among those people is partly because they are playing a more serious game in this area.
I used to use Gmail to notify when RPA was being executed or finished, but I decided that nowadays it is not necessary to use e-mail, so I decided to use LINE, which is popular mainly in Japan and some other Asian countries.
Although we use LINE casually, various APIs are available to application developers. In this case, I just want to send a message, so I'll use LINE Notify to make it as easy as possible. From the LINE Notify page, create a token, which is very popular nowadays. Token is a new word, but it is not so wrong to think of it as just a long password. Copy and paste this into a file on your Cloud Computer and save it. After that, all you have to do is access the dedicated LINE Notify page with your message. It's that easy. You can also send the message by typing in the URL in your browser, but it would be better to use a script since it would take a lot of time. In this example, we put the following contents in the file sendline.sh, and then type
#! /bin/bash -f curl -X POST -H 'Authorization: Bearer '`cat linetoken` -F 'message="'$1'"'' https://notify-api.line.me/api/notify
#! /bin/bash -f
curl -X POST -H 'Authorization: Bearer '`cat linetoken` -F 'message="'$1'"'' https://notify-api.line.me/api/notify
Add execution rights.
$ chmod +x sendline.sh
$ chmod +x sendline.sh
Note that in the above example, the tokens are stored in a file called linetoken. The cat linetoken`
is a symbol to tell you to extract the contents of the file linetoken
on the command line. The $1
means to set the value written at the back (called argument) when executing. When you run the command, it looks like this.
$ . /sendline.sh "line message from Cloud PC"
$ . /sendline.sh "line message from Cloud PC"
It seems that the destination of the line is not written, but that information is contained in the token issued. I wrote above that it is just a long password, but the token seems to have a slightly different role. Sikulix, which is an RPA tool, uses python, so when you call it from there, it looks like this
# Send a message from Sikulix Python to LINE m = "Message from Sikulix" subprocess.call(['linesend.sh', m]) ``` As a result, I received a message from **LINE Notify** without any problems (:-). This could be used in many ways.
# Send a message from Sikulix Python to LINE
m = "Message from Sikulix"
subprocess.call(['linesend.sh', m])
```
As a result, I received a message from **LINE Notify** without any problems (:-). This could be used in many ways.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home