Send SMS via Twilio


So I have st up twilio trial account, inserted the code into my .js. Everything works perfectly. But now what I want to do is, to limit sent sms when my sensor detects object. I would like the sms to be sent only once, when it reads the value and not x-times.

How can I do this in .js?

Thank you for your help!

Post the relevant code here and someone my be able to suggest how to modify it to achieve your objective.

function sendValues (socket) {
if (povprecnaVrednost < 40) {
console.log("Nevarnost poplav!");
alarm = 1;

//I want this part below only to be activated once

client.messages.create ({
to: 'xxxxxxxxxxxx',
from: 'xxxxxxxxxxxx',
body: 'Nevarnost! Nivo vode se pribli┼żuje kriti─Źnemu nivoju!'},
function(err, message) {
if(err) {
} else {