Skip to content

InboxFever API

stigmergic edited this page Jan 9, 2012 · 9 revisions

The InboxFever Email App API

The API provides the ability to receive and send Emails over HTTP. InboxFever handles receiving, parsing, storing attachments, tracking replies, and reporting statistics for your email app. Adding email to an existing app, or creating a new email based app is as easy as responding to an HTTP request.

Getting Started

First signup for an account on inboxfever.com

Go to the Accounts settings, make yourself a developer, and then create an app.

Apps consist primarily of an app name @inboxfever.com and a callback url. The callback url is where InboxFever will post emails which are received at your InboxFever email address. The post body will be a JSON formatted string containing the email data. It looks like:

Callback Post Body

{
    "updated": "234908570069", // timestamp of when this email thread was last updated
    "created": "234809890234", // timestamp of when this email thread started
    "thread_id": "b2daa282bf2c02078e6fc2ab68d17ea98f7b9d04", // This identifies email threads
    "email_id": "8ed57398a6b5a619bf2d6a9764c397f93fcb1127", // This is the unique id of this message
    "from": {
          "name": "Joshua Thorp",  // The sender's name 
        "address": "joshua@inboxfever.com", // Send email address
        "params":null // param in the address (name+param@host.domain)
    },
    "reply_to": "yelp@inboxfever.com",  // your app settings for email addrees, can be different then inboxfever address
    "to": {
        "name": "Yelp", // sent to name
        "address": "yelp@inboxfever.com",  //sent to address
        "params": null, // param in the address (name+param@host.domain)
    },
    "cc_list":[{name:"Maps", address:"maps@inboxfever.com"}], // CCs on this email
    "to_list":[{name:"Yelp", address:"yelp@inboxfever.com"}], // all to addresses
    "headers": {"":[],"":[]}, //headers from the email as a dictionary of list. entries are header names, lists are all entries of those header names. Most will only have 1 entry. All will at least have 1 entry.
    "attachments": ["http://staticstoage.co/dthompson@gmail.com/3964977730/guy_on_buffalo.png"], // a list of urls to files that were attached in the email. 
    "text": "\n\n-- \n Josh\n", // text version of email
    "html": "<br clear=\"all\"><div><br></div>-- <br> Josh<br>\n", // html version of email
    "subject": "test" // Email subject
    "request_id":"some kind of id"  // this can be used to track the status of the response. 
}

Email Response

When responding to a post request from InboxFever there are a couple of options.

To simply acknowledge receipt of the POST reply with a status of 200.

To send back a response email, reply with a JSON formatted body and an "application/json" content-type header set. The JSON body should look like:

{
    "to":"name@host.domain", // the to address
    "attachments": [ ["Filename","url_to_file"] ], // a list of attachments to send
    "text":"text message", // text content to send
    "html":"<h1>Html message</h1>", // html content to send
    "subject": "InboxFever API" // subject
}

Send New Email

Sometimes apps need to send an email that is not in response to a email that was just received. In order to do this use the email send API.

This API requires HTTPS and the application id & secret.

Send API endpoint: https://api.inboxfever.com/api/v1/email/send

{
    "app_id":"234123",
    "secret": "application secret",
    "to":"name@host.domain", // the to address
    "attachments": [ ["Filename","url_to_file"] ], // a list of attachments to send
    "text":"text message", // text content to send
    "html":"<h1>Html message</h1>", // html content to send
    "subject": "InboxFever API" // subject
}

Clone this wiki locally