Let’s connect? (And you thought we’d never apps.)

Developers, we’ve had a pretty thrilling relationship these last few years and we think it’s finally time to take the next big step. No more users needing to carry state between our applications, no more Push API calls without a reply, no more questions about where content comes from – we want you to be an active part of our users’ lives.

To make it happen, we’ve carved out a special place inside of foursquare for you to make your own. You can now send a customized reply to any user who has connected your application to their foursquare account. The reply will immediately appear on the user’s check-in detail screen, and taps directly into your web or native mobile app.

When a user checks in, foursquare sends a real time push notification to your app’s server. Your app then decides if it wants to reply and what that reply should say. As replies are received by the foursquare servers via the API, they are passed down to the client via APNS (iOS), C2DM (Android), or Push Service (BlackBerry). The foursquare client intercepts these notifications and embeds them in the check-in detail screen – for the user, it feels like the replies are happening nearly instantaneously within foursquare. If foursquare is closed, the notifications appear in the system notification tray, linking the user to their check-in detail page.

These replies can contain up to 200 characters, and also specify a URL and a “contentId.” The reply then taps through to an embedded webview with the URL loaded. If the user has your native app installed, however, we’ll send the user directly to your app, where you can key off of your contentId to show the corresponding content to the user. In both cases, we pass a callback URL so you can send the user back to foursquare when they’re done – by letting them jump in and out of the most relevant parts of your app, we hope to drive more engagement from foursquare users.

In addition to letting apps reply to users when they check in, we’re launching a related set of functionality for users when they post information to their check-ins from another application. For example, if a user shares a song on Soundtracking or spot a dish on Foodspotting and share it with foursquare, foursquare will create a special link back to the original application. The posted content also appears with attribution in the friends tab, helping new users discover and connect apps that their friends are using. We’ll also create a separate story in the friends tab when a user initially connects your app to their foursquare account, which means it’s even easier for your app to spread from friend to friend within our community of over 20 million users.

This new framework was built for everyone from weekend hackers and scrap startups to larger businesses and brands – we think all will benefit from being able to send personalized, contextual, and timely hooks to users when they’re already looking at their phone.

Read our announcement and the full overview here. We’ll continue twiddling and polishing this new framework over the coming months (give us your feedback!) before we fully launch it to users, but it should be stable enough for adventurous developers to start building new apps and features. If you build something, be sure to tell us and we’ll regularly highlight our favorite new apps. We currently have a limited app gallery featuring a few partners who have been helping us test the new endpoints, but when we launch to users, we’ll have a full app gallery and the best apps will get special treatment there. Be sure to subscribe to the foursquare-api mailing list for breaking news about changes.

- Akshay Patil (@ak)