Hooks

Email It In provides a web hook which is calledwhen we receive and upload an attachment to your storage service.

How Hooks Work

First enable a web hook on your Profile pagein the "Hooks" tab. Do this by specifying a URL we can HTTP POST to. You may wish to test this first with RequestBin.

Payload

The payload you receive will look something like the following:

{ headers: 
   { received: 
      [ 'from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182])\n by emailitin.com (Haraka/2.1.4) with ESMTPS id 080854D4-2ABA-49AB-B45A-742CC4F12DA5.1\n envelope-from \n (version=TLSv1/SSLv3 cipher=RC4-SHA verify=OK);\n Mon, 17 Jun 2013 19:00:13 +0000',
        'by mail-lb0-f182.google.com with SMTP id r11so2892787lbv.27\n for ; Mon, 17 Jun 2013 12:00:43 -0700 (PDT)',
        'by 10.114.92.204 with HTTP; Mon, 17 Jun 2013 12:00:42 -0700 (PDT)' ],
     'dkim-signature': [ 'v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20120113;\n h=mime-version:date:message-id:subject:from:to:content-type;\n bh=UEopJK9MMUaXnWxd+TBgxdsp9C96NORForVlvFYlBGs=;\n b=f8G5W/8bgJpbmzkxTuqGNIpnGI+qkBJeuok1KC0y8BScaM3tkV37Sw2QROZOoCjZGc\n 74cyQmeBVB8Nea+T+VkSvFoj4EgOYra3cscLEcl+btQMNaMzBGaV4hgnnl9xN8x2pCUY\n 5sBlEcLYj9UMJ3YpVqlpkmoRB1p1x9x/N8OKJGToah5FF3WSsiwYwZliIU6CNaO5jmrs\n jCI1FOJF1vhAtoeO6nMjxjwSS+dnMmdsZ202/YwFSP0rw2hEGtNqo+kFOWzNOHumUrej\n rjUMcUqEo4F5Lx9EkEJfb2q/RxLkav4jC1pR7fscm5dhDeKU7P7jG9zTbNYrCVHzhSWt\n SR0w==' ],
     'mime-version': [ '1.0' ],
     'x-received': [ 'by 10.112.13.199 with SMTP id j7mr3065754lbc.25.1371495642941;\n Mon, 17 Jun 2013 12:00:42 -0700 (PDT)' ],
     date: [ 'Mon, 17 Jun 2013 15:00:42 -0400' ],
     'message-id': [ '' ],
     subject: [ 'Hook Test' ],
     from: [ 'Matt ' ],
     to: [ 'your_emailitin_name@emailitin.com' ],
     'content-type': [ 'multipart/mixed; boundary=001a11c3cb9e9bceb504df5e363f' ] },
  envelope: 
   { mail_from: 'helpme@gmail.com',
     rcpt_to: [ 'your_emailitin_name@emailitin.com' ] },
  storage_response: 
   { kind: 'drive#file',
     id: 'xxxxxxxxxxxxxxxxxxxxxxxx',
     etag: '"zzzzzzzzzzzzz/yyyyyyyyyyyyyy"',
     selfLink: 'https://www.googleapis.com/drive/v2/files/xxxxxxxxxxxxxxxxxxxxxxxx',
     webContentLink: 'https://docs.google.com/uc?id=xxxxxxxxxxxxxxxxxxxxxxxx&export=download',
     alternateLink: 'https://docs.google.com/file/d/xxxxxxxxxxxxxxxxxxxxxxxx/edit?usp=drivesdk',
     iconLink: 'https://ssl.gstatic.com/docs/doclist/images/icon_11_image_list.png',
     title: 'logo.png',
     mimeType: 'image/png',
     labels: 
      { starred: false,
        hidden: false,
        trashed: false,
        restricted: false,
        viewed: true },
     createdDate: '2013-06-17T19:00:46.681Z',
     modifiedDate: '2013-06-17T19:00:46.363Z',
     modifiedByMeDate: '2013-06-17T19:00:46.363Z',
     lastViewedByMeDate: '2013-06-17T19:00:46.363Z',
     parents: [ { kind: 'drive#parentReference',
        id: 'xxxxxxxxxxxxxxxxxxxxxxxx',
        selfLink: 'https://www.googleapis.com/drive/v2/files/xxxxxxxxxxxxxxxxxxxxxxxx/parents/xxxxxxxxxxxxxxxxxxxxxxxx',
        parentLink: 'https://www.googleapis.com/drive/v2/files/xxxxxxxxxxxxxxxxxxxxxxxx',
        isRoot: false } ],
     downloadUrl: 'some very long URL',
     userPermission: 
      { kind: 'drive#permission',
        etag: '"zzzzzzzzzzzzz/yyyyyyyyyyyyyy"',
        id: 'me',
        selfLink: 'https://www.googleapis.com/drive/v2/files/xxxxxxxxxxxxxxxxxxxxxxxx/permissions/me',
        role: 'owner',
        type: 'user' },
     originalFilename: 'hubdoc_logo.png',
     fileExtension: 'png',
     md5Checksum: 'fe766dafa284bea0ef27f11082ff9b56',
     fileSize: '9052',
     quotaBytesUsed: '9052',
     ownerNames: [ 'Matt Sergeant' ],
     owners:       [ { kind: 'drive#user',
        displayName: 'Matt Sergeant',
        isAuthenticatedUser: true,
        permissionId: '05035858676739715365' } ],
     lastModifyingUserName: 'Matt Sergeant',
     lastModifyingUser: 
      { kind: 'drive#user',
        displayName: 'Matt Sergeant',
        isAuthenticatedUser: true,
        permissionId: '05035858676739715365' },
     editable: true,
     writersCanShare: true,
     shared: false,
     appDataContents: false } } 

Note that the storage_response entry differs in construction based on whichstorage backend it ended up going to. You can find examples of each on the following pages