Results 1 to 4 of 4

Thread: Trigger Action From Email

  1. #1
    Join Date
    Sep 2010
    Posts
    8

    Default Trigger Action From Email

    Hello, Is there a current way to trigger actions from email or SMS? Thanks!!

  2. #2
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    We don't have that yet. I'll try to have something for next release.
    Ron
    No support through PM

  3. #3
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    Alright if you grab version 6.0.0.47 I have added imap support.

    Basically take the example code from the manual ( scripting/socket/imap )

    Then at the spot where it prints the message change it to look for some special magic sentence that instructs Girder to do something for example

    Code:
    local eventDevice, eventString = message:match("GIRDER TRIGGER EVENT (%d+) \"([^\"]+)")
    if eventDevice then
        gir.triggerEvent(eventString, eventDevice, 0)
    end
    Now send an email message to the account you are checking with the text:

    Code:
    GIRDER TRIGGER EVENT 18 "HELLO THERE"
    Once all that works put that scripting action on a scheduler to check however often you like

    The full action:
    Code:
        imap = require('socket.imap') 
        i = imap.new( "imap.gmail.com", 993, "tlsv1", 1000)
     
    
         if not i:connect() then
             print("Failed to connected")
             return
         end
     
    
         if not i:login("youremail@gmail.com", "yourpassword") then
             print("Login failed.")
             return
         end
     
    
         -- Select your desired mailbox
         if not i:select("Inbox") then
             print("Could not select mailbox")
             return
         end
     
    
         -- get a list of unseen messages
         local status, unseenMessageList = i:unseen()
         if not status then
             print("Could not get list of unseen messages")
             return
         end
     
    
         if #unseenMessageList == 0 then
             print("No unseen messages")
             return
         end
     
    
         -- get the first unseen message marking it as seen.
         local status, message = i:fetchMessage( unseenMessageList[ 1 ], false )
         if not status then
             print("Could not get message")
             return
         end
     
    
     
    
         --print( message )
         
         local eventDevice, eventString = message:match("GIRDER TRIGGER EVENT (%d+) \"([^\"]+)")
         if eventDevice then
             gir.triggerEvent(eventString, eventDevice, 0)
         end
     
    
     
    
         i:deinit()
         i = nil
    Ron
    No support through PM

  4. #4
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    SMS is possible if you expose your Girder webserver to the internet in combination with Twilio.
    Ron
    No support through PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •