Script to send email notification on success/failure?
Hi,
I've written a script to do some automated Audiosuite processing and then saving the session to a user defined file path - and I was wondering if there is a way of sending an email notification as a final step. I'm including a check step which checks that the session folder that has been created exists before a final "Success" message pops up. It would be great if upon a failure of that check, an email could be sent to alert the user to investigate.
Best
Matt
- samuel henriques @samuel_henriques
Hello Matt,
I think you could automate all steps if creating an email and send it with macro actions.
But if you are interested, people have made iMessage notifications, if you use Iphone.
There is a way using IFTTT, I've use it for a long time.
How to get push notifications from soundflow using IFTTT
Now I'm using Telegram notifications.
Create a bot, https://t.me/BotFather
make a group of you and the bot.
Then send custom messages to yourself from soundFlow:function sendTelegramMessage(message) { //https://t.me/BotFather const token = 'Your Bot Token Here'; const botId = 'Your Bot Id Here'; sf.net.httpRequest({ url: `https://api.telegram.org/bot${token}/sendMessage?chat_id=${botId}&text=${message}`, method: "GET", }).asString(); };
Hope this helps
- CIn reply toMatt_Facey⬆:Charles Elmi @Charles_Elmi
Hey Matt,
3 options to get you creative:
A) You can use EmailJS, which lets you send 200 emails for free per month. Just setup your gmail or whatever as sender and create a template. Setup the code like this:
let temp, post, module = 'NAME OF APP OR FUNCTION YOU HAVE CREATED', status = 'IF THE FUNCTION FAILED OR SUCCEEDED ETC.'; temp = { service_id: '<YOUR ID>', template_id: '<YOUR TEMPLATE ID>', user_id: '<YOUR USER ID>', }; temp.template_params = { 'module': module, 'status': status }; post = sf.net.httpRequest({ url: `https://api.emailjs.com/api/v1.0/email/send`, contentType: 'Json', method: 'POST', data: temp }); post.asString();
B) You can use Gmail API. Though this could get a bit tricky but is slick when done right. I use Gmail API together with Python which I find to be the easiest way.
C) You could simply let SF open the mail.app, create a new mail, type in the address, subject, body and send it away. Not as 'clean' as option A & B but will do the job for you!! :):)