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.

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 - When processing of template, gif, boomerang, or video starts after capture is complete.
  • sharing_screen - When sharing screen is displayed.
  • printing - When application is starting to print.
  • 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:19:47.130 { event_type: 'printing' }
16:19:57.130 { event_type: 'session_end' }

Triggers to URL

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 with command line arguments.

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

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%
echo Batch file started  >> c:\temp\status.txt 
echo Received event: %1 >> c:\temp\status.txt 
echo Received param1: %2 >> c:\temp\status.txt
echo Received param2: %3 >> c:\temp\status.txt
echo Completed: %date% %time%  >> c:\temp\status.txt 
Was this article helpful?
0 out of 1 found this helpful
Have more questions? Submit a request

24 Comments

  • 0
    Avatar
    Ely Miranda

    Nice.  Will there be anymore documentation?  For instance, what does file_download pertain to?  Is this the session print?

  • 0
    Avatar
    Mike

    We just updated the documentation. Let us know if you have any other questions.

  • 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
    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
    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
    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
    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

    You were right, I need to use the full path.

    It works, awesone, thanks!

  • 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
    Julien Duijsens

    with the full link to the file, it works great! I like this soft !!!!

    Is it possible to have an event when the application starts and when it stops?

  • 0
    Avatar
    Rakesh574

    Hi Mike, Is there a way to filter out the event that I want instead of getting all of the generated events? Thanks 

  • 0
    Avatar
    Mike

    You'd have to filter in your own code/script. See updated dos example above.

    Edited by Mike
  • 1
    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  ??

  • 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

  • 1
    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

  • 0
    Avatar
    Okkaleab

    Hello, I want to use the triggering option to play a camera shutter sound every time the camera takes a picture. Am using a webcam. Since there is no flashlight I want the shutter sound to notify my guests besides the countdown on the screen. I don't know much about programming. Please, can you give me an example on how to trigger sounds.

     

  • 0
    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

  • 0
    Avatar
    john

    I also cannot get my led ring to trigger.  The documentation does not make it clear to me how to make dslrbooth run the application to trigger my led ring.  I can trigger the led ring perfectly from the cmd prompt so I know it is working but I cannot figure how to have that cmd line program run from inside dslrbooth.

     

    Thanks,

     

    john

  • 0
    Avatar
    john

    Thank to Mike and some added notes and guidance on the help page here I have got it working!  I just had to put c:\temp\test.bat in the spot in dslrbooth trigger section and here it what is in my test.bat file:

     

    @echo off
    IF "%1"=="countdown_start" (
     start /b c:\windows\serialsend.exe "%2"
     )
     
     
    That works perfectly to trigger the Arduino code.
     
    Thanks again to Mike for all his help!
     
    Thank you,
     
    John
  • 0
    Avatar
    Florens Schneider

    Hi Mike! Our plan is to show the media remaining after printed out a photo. Therefore we want to use the trigger feature to start an external application after session out which calculates the printer media remaining and show the media remaining value in the dslrbooth fullscreen?

    Is that possible or blocks the dslrbooth fullscreen mode the Message from the external application.

    Do you know another way to integrate the media remaining counter in the dslrbooth screen.

  • 0
    Avatar
    Sebastian Böhm

    Hi Florens,

    what printer do you use?

  • 0
    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?

  • 0
    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!

Please sign in to leave a comment.