Automatic emails if account balance is low

You can easily using the NodeHost API get a email with current account balance at any frequency you want if the balance is below a threshold. Just create a new worker, insert this script and enter in your API key. As long as your have the email alert type turned on you will get an update when ever the worker runs.

You can then set when it will run by clicking the button directly under the workers image on the menu to set how often it will get triggered.

v.apikey="PUTYOURKEYHERE"
v.credit="0"
v.ifbelow="2"

v.getuserinfo=s.http_request_get("https://api.nodehost.cloud/get_account_info?api_key=v.apikey")
v.data=s.json_decode(v.getuserinfo)
if set v.data[data][credit]
    v.credit=v.data[data][credit]
    v.credit/100
end

if v.credit<=v.ifbelow

    v.title=s.string_url_encode("Low ballance for account @v.data[data][username]")
    v.message=s.base64_encode("Just letting you know about your current ballance on your account @v.data[data][username] as it's below your alert ammount of $v.ifbelow with a current balance of $v.credit on the account.")
    
    v.sendemail=s.http_request_get("https://api.nodehost.cloud/post_account_email_create?api_key=v.apikey&subject=v.title&message=v.message&type=alert&encoded=true")
    v.response=s.json_decode(v.sendemail)
    if notset v.response[data][error]
    	s.echo("EMAIL SENT")
    else
    	s.echo("EMAIL DID NOT SEND")
    end
    
else
    s.echo("GOOD")
end