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]¶m1=[param1]¶m2=[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.
64 Comments