Tired of saving backups of your PDFs from your email notifications? Looking for a way to send your PDF documents to other services? Well, we’ve got a nice solution. We have created a new type of notification, called Webhook Delivery.
You have probably seen the term “webhook” before, as we refer to our Merge URLs and Data Routing URLs as Webhook URLs. With this in mind, the notifications are very similar except we are sending the data to the URL instead of accepting the request from another source.
To setup a new Webhook Delivery, click the Delivery tab when editing your document, then click New Delivery. To finish, all you need to do is enter the URL of the script that you want to send your PDF to. There are a few other options, such as the Handshake Key and Conditions which are optional.
Now, what data should you expect to receive? The easiest thing to do is use a service like RequestBin (http://requestb.in) to visually see the data we send, but we will send the Merge ID, File Name, File Contents, and Fields (this is an advanced option).
$_POST[‘merge_id’] = 12345
$_POST[‘file_name’] = “Contract – John Smith.pdf”
$_POST[‘file_contents’] = base64_encode(“%PDF… (PDF CONTENTS) … %%EOF”)
$_POST['fields'] = array(
'name' => 'John Smith',
'email' => 'email@example.com',
Since we are sending the contents of the PDF, you will need to save that into a PDF file on your server.
Need to accept JSON? No problem - simply click the [More Options] link when setting up the webhook notification and check the box indicating you would like to receive the data using JSON.
More information on Webhooks: http://webhooks.pbworks.com/