Page 1 of 1

send camera snapshot

Posted: Thursday 07 March 2024 21:26
by ssk17051980
I'm trying to send a notification in Telegram with a snapshot from a camera.
I can't do it at all.

Re: send camera snapshot

Posted: Thursday 07 March 2024 22:19
by azonneveld
Create a script file and paste code below.
Then call the script from your code

(script must be executable, make it so: sudo chmod +x [scriptfile] )

Code: Select all

#!/bin/sh

#FILE LOCATION
SnapFile="[LOCATION FOR TEMP STORAGE]"

#FETCH SNAPSHOT
wget "[URL TO GET SNAPSHOT]" -O $SnapFile

#SEND SNAPSHOT
curl -s -X POST "https://api.telegram.org/bot[APIKEY]/sendPhoto" -F chat_id=[CHATID] -F photo="@$SnapFile"

#REMOVE FILE
rm $SnapFile

Re: send camera snapshot

Posted: Friday 08 March 2024 8:41
by ssk17051980
thx. i gone try tonight