Follow

Triggers/API

For technical users who would like to have certain events that occur in dslrBooth trigger an external action, dslrBooth offers Triggers.

Triggers are useful for integrating lights, sounds and other applications with dslrBooth. This will have dslrBooth call an application or a URL when certain events happens. You can set Triggers under: Settings > General > Triggers. dslrBooth will send your application the event type as well as some additional parameters. Your app will then receive this data and do what you wish.

Event Types

The following event types are currently sent:

  • session_start [booth_mode] - When session starts.
  • countdown_start [seconds] - When countdown first starts.
  • countdown [percent_complete] - Updates with percentage of countdown complete.
  • capture_start - When app tells camera to capture a photo.
  • file_download [name_of_file_from_camera] - When a file is received from the camera.
  • processing_start [original_photo_filenames]? [final_file] - When processing of template, gif, boomerang, or video starts after capture is complete. For video/gif/boomerang session, only the final video filename is available.
  • sharing_screen - When sharing screen is displayed.
  • printing [file] [num_copies] [printer_name] - When application is starting to print.
  • file_upload [file] [url] [file_type] [album_name] - When a file is uploaded to fotoshare.co cloud hosting site.
  • session_end - When sharing screen completes and start screen is about to display.

Here are some sample events that you can receive:

16:20:7.287 { event_type: 'session_start', param1: 'PrintAndGIF' }
16:20:7.839 { event_type: 'countdown_start', param1: '5' }
16:20:12.624 { event_type: 'countdown', param1: '20' } 16:20:12.624 { event_type: 'countdown', param1: '50' } ... 16:20:12.624 { event_type: 'countdown', param1: '100' } 16:20:12.626 { event_type: 'capture_start' } 16:20:13.626 { event_type: 'file_download', param1: '20180202_162013_455.jpg' } 16:20:17.559 { event_type: 'processing_start' } 16:20:30.576 { event_type: 'sharing_screen' }
16:20:30.576 { event_type: 'file_upload', param1: 'c:\booth\Videos\encoded\file.mp4', param2: 'https://fotoshare.co/xxxx', param3: 'video', param4: 'Album Name' } 16:19:47.130 { event_type: 'printing', param1:'c:\booth\Prints\file.jpg', param2:'1', param3:'DS-RX1' }
16:19:57.130 { event_type: 'session_end' }

Triggers to URL (Webhooks)

dslrBooth will call a URL that you define under settings with different events during a guest's session. Your URL will receive and event type as well as a list of parameters with details on the event. During your development, you can use a site such as request catcher to view the generated events and their properties.

The previous log was generated using this NodeJS but you can do the same in any programming language:

const express = require('express')
const app = express()

app.get('/', function(req, res){
  var today = new Date();
  var time = today.getHours() + ":" + today.getMinutes() + ":" + today.get
Seconds() + "." + today.getMilliseconds();
  console.log(time, req.query);
  res.send('Parameters received: '+ JSON.stringify(req.query));
});
app.listen(3000) ;

Triggers to Application

Similarly, the trigger can execute an application that you set in dslrBooth's Settings, Triggers. Please only enter the path of your batch or application and nothing else.

As dslrBooth's runs, it will start your application and send it additional data (eventTyep and param1, param2, ...) command line arguments. Your app will receive this data and figure out what needs to be done.

[appname.exe] [EventType] [param1?] [param2?] [param3?] ...

Dos Batch File Example

You can use the following batch file to get you started which will receive the event sent from dslrBooth and append it to a text file.

:: contents of test.bat - make sure temp directory exists
@echo off
echo Batch File Started: %date% %time% >> c:\temp\status.txt 
:: Optionally log the received event and params for event types echo Batch file started >> c:\temp\status.txt echo Received eventType: %~1 >> c:\temp\status.txt echo Received param1: %~2 >> c:\temp\status.txt echo Received param2: %~3 >> c:\temp\status.txt
echo Received param2: %~4 >> c:\temp\status.txt

:: Log the received event and params for a specific event type. IF "%~1"=="countdown_start" ( 
echo "Countdown Started" >> c:\temp\countdown_only.txt
)

:: Optionally log the current date and time echo Completed: %date% %time% >> c:\temp\status.txt

Related Tools

  • SerialSend - Sends characters to a serial port. Can be used for turning lights on and off.
Was this article helpful?
0 out of 2 found this helpful
Have more questions? Submit a request

58 Comments

  • 5
    Avatar
    Office

    Does anyone have an example of how I can set a Phidget-Port at the beginning of the countdown?
    I use a Ledring (controlled with Arduino ) that starts with the start of the countdown, the duration is from the Arduino at 1. Run calibrated.

    Thank you

  • 4
    Avatar
    Cedric

    @ office

    can you offer me the code in dslrbooth and arduino IDE to get those led rings work ?

     

    @ Admins:

    Could you please extend your documentation about the triggers ? I don´t get it. I tried to start a application (.exe) or a batch-file (.bat). But it seems to me that both applications won´t start.

    I would really like to add a WS2812b ring light countdown to the photobooth.

    any help would be appreciated.

    thank you

  • 3
    Avatar
    Master Mark

    Hi guys what command would i use to turn on my leds then off again

    before a camera trigger

    countdown_start

    capture_start  ??

  • 2
    Avatar
    Julien Duijsens

    Hello,

    is it possible to create an event when the application start and when you close the application?

    it's important to initialize the lamps and I'm also using a Neo ring around the lens of the camera to get attention and catch the eye.

    thank you !

  • 1
    Avatar
    ali edi

    Hi John it is posible to give me your code for the booth, to used with ws2812 and arduino.  It was very helpful for me.
    aliediz@gmx.de
    many thanks.
     
    edi

  • 1
    Avatar
    Florens Schneider

    Hi Sebastian, we use different DNP printers. The application to read the current media remaining from the dnp printer is ready. So it's just the way to integrate it in the dslrbooth screen ;).

    But why you are asking for the printer? Do you have the same plan?

  • 1
    Avatar
    Sebastian Böhm

    Hi Florens, We're using RX1-printers and found a solution to extract the status and remaining media for our use internally (Webtool that's indpendent from the photobooth software used. You have a solution for all DNP-printers? Maybe you'd like to share some details?

    You can write me an Email or give me a call:

    +49 179-2093679

    sebastian@fotoautomat-berlin.de

     

    Thanks!

  • 1
    Avatar
    Mike

    @Erik

    IF "%1"=="session_start" (
    start /b c:\serialsend.exe com3 /baudrate 9600 "%2"
    )

    IF "%1"=="sharing_screen" (
    # send different command here
    )

  • 0
    Avatar
    Mike

    Tobias, the number of prints is not yet available. Please add your suggestion here.

  • 0
    Avatar
    Smart Magic Mirror

    Can Anyone provide us detail coding  to place ring light with audrino. I want the ring light to start on countdown and close when it displays 1 in countdown. I am not a programmer, if anyone could help, please mail to smartselfiebooths@gmail.com

  • 0
    Avatar
    Julien Duijsens

    Hello, congratulations for this work, the application is really well thought. 

    I do not quite understand the command line that must be called to run the .bat. 
     
    Could you enlighten me? It's like this?
    C:\photobooth\status.bat [capture_start] 
     
     
  • 0
    Avatar
    Erik

    Hi there - I am not very technical, hence the question... I would like the program to trigger / launch an EXE file, preferably 60 seconds after DSLR booth was last used OR once a user emailed the photo to themselves. Is this possible? how would one do that? (currently I convert the EXE to a SCR file and install it as a screen saver but for some reason it is not very reliable - please help

     

  • 0
    Avatar
    Thomas

    Hi there, im planning to use an ip camera with dslrbooth. Video integration works well..

    How can i send a http command to my camera at capture_start to trigger some action and another command at session_end to stop it? I know which commands my camera will accept, but have no idea how to set in dslrbooth.

    Sorry, i'm a total noob with APIs.

    Thank you!

  • 0
    Avatar
    Tim Kropp

    Hi there,

     

    I´ve created a batch file which is talking to an arduino to activate GPIOs...

    I´ve updated to the latest version 5.28 and I want to add the video start trigger but it doesn´t work I´ve tried 

    "session_start video"

    "session_start [video]"

    "session_start[video]"

    in photo mode everything is working but I cannot find the correct Trigger name I have to set, when I am starting video record...

    This is my batch file:

    @echo off
    IF "%1"=="session_start[video]" (
    start /b c:\Users\timkr\SerialSend.exe /baudrate 9600 /devnum 11 SwitchVideoOn
    exit
    )

    IF "%1"=="countdown_start" (
    start /b c:\Users\timkr\SerialSend.exe /baudrate 9600 /devnum 11 SwitchRelayON
    exit
    )

    IF "%1"=="session_end" (
    start /b c:\Users\timkr\SerialSend.exe /baudrate 9600 /devnum 11 SwitchRelayOFF
    exit
    )

     

    Please help.

    thanks in advance

    Tim

  • 0
    Avatar
    Nacho DM

    Hi, I imagine that this would seem very beginner, but someone could put a link to a website that explains how to program, is that I'm interested but I have no idea what is being talked about here

  • 0
    Avatar
    Mike

    @Tim,

    The first argument is "session_start" which will be stored in %1.

    The second argument for a video session would be "Video" which would be stored in %2

    IF "%1"=="session_start" (

        :: A session of type %2 started (Photo, Video, Gif, boomerang)

      IF "%2" == "Video" (

        :: Video session started

      )

    )

    Edited by Mike
  • 0
    Avatar
    Marco

    Hi,

    this is really great stuff!

    I managed to connect dslrBooth with a power automation system and a database. And there are so many more things we can do now!

    As I was (one of) the guy(s) who requested this feature...: Is it too early to ask for enhancements? ;-) Here are my favorite 3:

    1. Please add the number of prints (fortunately the return codes for event "printing" are free for this.

    2. Please return which template was used for creating the prints. Maybe as return code of processing_start?!

    3. If would be much easier to code if you please could return the percentage at "countdown" always as 3-digit number with leading zeros.

    I am really looking forward getting more and more opportunities with your API!

    Thanks a lot, best,

    Marco.

  • 0
    Avatar
    Daniel Schwarz

    hi, i dont know what the "param1" Param2" etc means....could anyone explain?

  • 0
    Avatar
    Mike

    Yes, dslrBooth will start a new process and run the application you set under Triggers > Application. It's likely the text file is getting written to but in a different directory. Try this instead to specify the full path to the text file.

    echo %* > c:\temp\status.txt
  • 0
    Avatar
    Sebastian Böhm

    Like Julien, I'm afraid i do not understand how this works. The batchfile itself works, cmd-line parameters are written directly into the textfile when i try it manually.

    But it seems, the file itself is not being executed when using dlsrbooth?

     

    Also, the actual printcount would be much appreciated.

    Edited by Sebastian Böhm
  • 0
    Avatar
    Tobias Niepel

    Hi Florens! Actually, I would be happy to be enabled to do so myself as I am a software developer in my day job. ;-)
    To me it is important, that I can remotely control some thinks of my photo booth using a smartphone and a web browser. Actually, I could even trigger a session manually from the phone with the press of a button. That frontend should also be able to show a (resettable) print counter, and it would be awesome to have that feature supported in dslrBooth.

    (I assume the piece of software you referenced to is something like PaperCut?)

  • 0
    Avatar
    Andrea

    hi, I would like to start a 20 second application at the start of the first countdown. Could I receive the correct text string to type?

  • 0
    Avatar
    Sebastian Böhm

    Hi, would it also be possible, to write those status in a log file? Another booth software I use simply writes the current states into a log file, overwriting the old. Thus, I always have a short info, what state the booth is currently in :-)

  • 0
    Avatar
    Mike

    Hey Sebastian,

    It should be rather simple to do this using the Trigger to Application with a dos batch file with the following contents:

    :: contents of status.bat
    @echo off
    echo %* > c:\temp\status.txt
    Edited by Mike
  • 0
    Avatar
    Erik

    ok, I'm back...

    In DSLR Booth, under Triggers I launch the file c:\test.bat (which is exactly where the bat file is - so far so good. 

    The Bat file has the following code: (copied and pasted from previous poster) and with Serialsend.exe on c:\ root directory 

    ---

     @echo off
    IF "%1"=="session_start" (
    start /b c:\serialsend.exe com3 /baudrate 9600 "%2"
    )

    ---

    When I start a session it triggers the arduino as desired - whoop whoop

    Unfortunately ..... I need to receive a trigger either when the session ends, or when printing starts.... The way I see it the session_start is the firstpossible trigger so it makes sense that it is picked up immediately .... i want the trigger 20 seconds into the session - by then, I assume my bat file is closed and forgotten? 

     

    anyone willing to throw in their 5c worth? I am about to give up completely

  • 0
    Avatar
    Erik

    @Mike

     

    You rock

  • 0
    Avatar
    Lars Wiczynski

    Good evening from Germany. I want to write a .bat file for the trigger. but unfortunately not like. after triggering the camera I would like to save the {fotoshare_url} as a file name
  • 0
    Avatar
    giannthemis

    Hello.

    Because I do not have much experience I would like someone to help me make a led ring with arduino and with led WS2812 . If anyone knows the codes please send it to me.
     
  • 0
    Avatar
    Thomas

    No hints on this?

    My camera would understand a command like: http://10.0.0.2/axis-cgi/virtualinput/activate.cgi?schemaversion=1&port=1

    Is it possible to send this command on session start?

    Thanks you!
    Thomas

  • 0
    Avatar
    Florens Schneider

    Hi Sebastian, i wrote an eMail.

    Best Regards

Please sign in to leave a comment.