JKrause Posted January 18, 2016 Report Posted January 18, 2016 Hello, I've been working on a simple action that moves approved files from our internal VFX server to a server used by our editors. The editors don't use FTrack, so I'd like to create custom email notifications to inform them when a file has been moved into their transfer folder. Is there a way to access email via the API? Since the editors aren't Ftrack users, I would like to store their email in the shot's metadata and send a simple "Shot XXXX has been transferred" notice whenever the action is used. Any advice is appreciated, Joshua
tokejepsen Posted January 18, 2016 Report Posted January 18, 2016 We use Slack for any custom notification. Its a lot easier to do with; https://github.com/os/slacker Worth considering if your editors are up for adopting Slack.
Mattias Lagergren Posted January 19, 2016 Report Posted January 19, 2016 Quote Is there a way to access email via the API? You can access the e-mail addresses on users with the http://ftrack-python-api.rtd.ftrack.com/en/latest/. E.g: for user in session.query('User'): print user['email']
JKrause Posted February 10, 2016 Author Report Posted February 10, 2016 Thanks for the advice! Unfortunately our editors aren't up for adopting anything new. Therefore I simply added their email addresses as metadata at the project level, queried it via API, and used Python's default smtplib module to send notification emails. This worked great. This brings me to my next question. My original notification script was coded as a generic Ftrack action, but my supervisor requested that I convert it into a Connect hook. Unfortunately, after a bunch of debugging, I've found that 'import smtplib' doesn't work in Connect. The hook fails to load. Is there a known work-around? EDIT: Mattias gave me some help in chat. I didn't realize that Connect has its own Python library. I placed a copy of the smtplib into 'Library.zip' and my action worked as expected.
Mattias Lagergren Posted February 12, 2016 Report Posted February 12, 2016 On 2/10/2016 at 9:13 PM, JKrause said: EDIT: Mattias gave me some help in chat. I didn't realize that Connect has its own Python library. I placed a copy of the smtplib into 'Library.zip' and my action worked as expected. I'm glad to hear that Mattias Seebergs could help you. That is true; ftrack Connect is a cx_Freeze bundle that has it's own python interpreter and libraries bundled - to ensure that it works regardless of installation. Unfortunately it does not package all of the standard libraries into Library.zip. Another way that may be easier than modifying Library.zip is to do a sys.path.append('path/to/smtp/library/') in your script. That way you do not have to modify Library.zip every time you update Connect.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.