Introducing web hooks
Use web hooks to be notified when a screenshot is done. We have added a new parameter to the screenshot/create API call. You can specify a URL, the web hook, to send notifications to.
When a screenshot is done (status: finished or error), Browshot will send a POST request to your URL. The body of the request contains the JSON data describing the screenshot as returned by the API call screenshot/info. If the URL does not return the status code 20X or times out, the notification will be retried up to 2 times.
Test your URL
You can test your URL by sending a POST request like this:
curl -X POST -H "Content-Type: application/json" \
-d '{\
"id": "12589",\
"status": "finished",\
"screenshot_url": "https://browshot.com/screenshot/image/15/12589?scale=1&key=my_key",\
"priority": "12",\
"url": "http://www.google.com/",\
"size": "screen",\
"width": "1024",\
"height": "768",\
"request_time": "1312106111",\
"started": "1312258803994",\
"load": "1312258829461",\
"content": "1312258829661",\
"finished": "1312258829681",\
"instance_id": "12",\
"response_code": "200",\
"final_url": "http://www.google.com/",\
"content_type":"text/html",\
"scale": "1",\
"cost": "0",\
"referer": "",\
"post_data": "foo=bar",\
"cookie": "",\
"delay": "5",\
"flash_delay": "10",\
"script": "",\
"shared_url": "",\
"details": 2\
}' \
https://mysite.com/myhook