Follow

Triggers (Webhooks) and API

For developers and advanced users who would like to be integrate their custom apps with dslrBooth, there are two options:

  • Triggers - Get notified when certain events occur in dslrBooth. You can use these events to turn on light, update a database, or take any other custom action.
    URL Triggers | Application/Script Triggers
  • API - Send commands to dslrBooth. You can use this to start a specific type of session, show/exit the lock screen, or print and share a session over email or SMS.

Triggers

Triggers are useful for integrating lights, sounds and other applications with dslrBooth. For example, turn on an led light when countdown starts, flash right before capturing a photo, and turn it off afterwards. To allow interacting with other apps, dslrBooth calls an application or a URL that you specify 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.

dslrBooth will call your chosen url and send it event_type and param1 and param2. Assuming you set URL to http://127.0.0.1:8000, dslrBooth will call this url multiple times:

http://127.0.0.1:8000?event_type=[EventType]&param1=[param1]&param2=[param2]

The above 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 (EventType and param1, param2, ...) command line arguments. Your app will receive this data and figure out what needs to be done.

For example, assuming you set application to c:\myscript.bat, dslrBooth will call your script multiple times with different events throughout a user's session:

c:\myscript.bat [EventType] [parameter1] [parameter2]


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.

API

Our API allows developers and advanced users to integrate custom apps and 3rd party software with dslrBooth. Using the new API, you can communicate and send commands to dslrBooth. This feature is available in dslrBooth v6.40 or greater.

The API allows you to run the following commands:

  • Start a Print/GIF/Boomerang/Video session
  • Show/Exit the lock screen
  • Print a specific number of copies
  • Share an email/SMS with the final print or video

You can access this under Settings, General, API. API Documentation is available online.

Reach out to us and let us know how we can improve our triggers and API to further help you integrate with dslrBooth. 

Was this article helpful?
0 out of 5 found this helpful
Have more questions? Submit a request

64 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
    Michael

    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
    Michael

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

    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
    Michael

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

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

  • 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

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

     

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

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

  • 0
    Avatar
    Florens Schneider

    Hi Sebastian, i wrote an eMail.

    Best Regards

  • 0
    Avatar
    Office

    Have you the Info also for me ?

    Many Thanks

    office@ritz.at

  • 0
    Avatar
    Florens Schneider

    @Mike: Feature request for the developers

    It would be perfect to enable or disable a specific event. Currently the user can notify an application just everytime ...

  • 0
    Avatar
    Lars Wiczynski

    I would like to print out the link to fotoshare after the photo.

     

    How can I do that ?

     

    or best if you can save the pressure with the fotoshare link as a file name

     

    Edited by Lars Wiczynski
  • 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
    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

     

Please sign in to leave a comment.