# Houston **Apple Push Notifications. No Dirigible Required** > Houston, We Have Liftoff! Push Notifications don't have to be difficult. And now they aren't. Houston is a simple gem for sending Apple Push Notifications. Pass your credentials, construct your message, and send it. In a production application, you will probably want to schedule or queue notifications into a background job. Whether you're using [queue_classic](https://github.com/ryandotsmith/queue_classic), [resque](https://github.com/defunkt/resque), or rolling you own infrastructure, integrating Houston couldn't be simpler. Another caveat is that Houston doesn't manage device tokens for you. Since infrastructures can vary dramatically for these kinds of things, being agnostic and not forcing any conventions here is more a feature than a bug. That said, a simple web service adapter, similar to [Rack::CoreData](https://github.com/mattt/rack-core-data) may be in the cards. ## Usage ```ruby # Environment variables are automatically read, or can be overridden by any specified options APN = Houston::Client.new APN.certificate = File.read("/path/to/apple_push_notification.pem") # An example of the token sent back when a device registers for notifications token = "<42e33061 9695b86b 59e5452b 061774c9 726eb8ec 22982c4b 558e34e2 784adee0>" # Create a notification that alerts a message to the user, plays a sound, and sets the badge on the app notification = Houston::Notification.new(device: token) notification.alert = "Hello, World!" # Notifications can also change the badge count, have a custom sound, or pass along arbitrary data. notification.badge = 57 notification.sound = "sosumi.aiff" notification.custom_data = {foo: "bar"} # And... sent! That's all it takes. APN.push(notification) ``` ## Converting Your Certificate > These instructions come from the [APN on Rails](https://github.com/PRX/apn_on_rails) project, which is another great option for sending push notifications. Once you have the certificate from Apple for your application, export your key and the apple certificate as p12 files. Here is a quick walkthrough on how to do this: 1. Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key. 2. Right click and choose `Export 2 items…`. 3. Choose the p12 format from the drop down and name it `cert.p12`. Now covert the p12 file to a pem file: ``` $ openssl pkcs12 -in cert.p12 -out apple_push_notification_production.pem -nodes -clcerts ``` If you are using a development certificate, then change the name to apple_push_notification_development.pem instead. Store the contents of the certificate files on the app model for the app you want to send notifications to. ## Contact Mattt Thompson - http://github.com/mattt - http://twitter.com/mattt - m@mattt.me ## License Houston is available under the MIT license. See the LICENSE file for more info.