Dear all,
I'm trying to set-up an clickatell notifcitation.
Does someone know how you can make this cURL POST in LUA?
When browsing through other scripts I was only able to find an different HTTP calls 'http://api.clickatell.com/http/sendmsg?....."
Has something changed over time?
CURL CALL:
==========
curl -i \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: 2Y5zsIpqQyqImq6o308ctw==" \
-d '{"content": "Test Message Text", "to": ["+3161234567"]}' \
-s https://platform.clickatell.com/messages
Best regards
Clickatell and LUA
Moderator: leecollings
-
- Posts: 1
- Joined: Wednesday 01 March 2017 10:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: my own
- Location: France
- Contact:
Re: Clickatell and LUA
Hello,
for any shell command, you could call os.execute() :
Make sure to escape quotes.
Note that the command will be executed with sh (and not with bash).
for any shell command, you could call os.execute() :
Code: Select all
os.execute('echo "Hello" | nc localhost 12012');
Code: Select all
os.execute('curl -i -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: 2Y5zsIpqQyqImq6o308ctw==" -d \'{"content": "Test Message Text", "to": ["+3161234567"]}\' -s https://platform.clickatell.com/messages ");
Note that the command will be executed with sh (and not with bash).
-
- Posts: 14
- Joined: Friday 24 February 2017 20:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Clickatell and LUA
Thanks it worked like a charm!! Escaping the quotes was something I was not able to figure out myself
Code: Select all
os.execute('curl -i -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: 2Y5zsIpqQyqImq6o308ctw==" -d \'{"content": "Test Message Text", "to": ["+3161234567"]}\' -s https://platform.clickatell.com/messages ')
Who is online
Users browsing this forum: No registered users and 1 guest