Foursquare
AIRSHIP VERIFIED INTEGRATION
This integration is maintained by Foursquare. Please contact Foursquare for support.Airship can easily integrate with Foursquare’s Movement SDK by associating channels with Foursquare user identifiers. This allows a single user to be consistently identified across both platforms.
Foursquare Integration Requirements
Accounts
- Foursquare
- Airship — Must include Messaging
Airship project
- The Airship SDK must use the same user identity as the Foursquare SDK
Associating the Foursquare Movement user identifiers with Airship channels can be accomplished with the following code.
Client Code: iOS
On iOS, associating a Foursquare Movement user identifier with an Airship channel should
be done inside a callback triggered by the UAChannelUpdatedEvent
. This is to ensure
the channel ID is set immediately once it’s available.
// Observe the notification center event `UAChannelUpdatedEvent`
NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.updateUserID), name:NSNotification.Name(rawValue:UAChannelUpdatedEvent), object: nil)
// In the notification callback set the userID on your Movement SDK Manager instance
func updateUserID() {
if let channelID = UAirship.push().channelID, let _ = FSQMovementSdkManager.shared().userInfo {
FSQMovementSdkManager.shared().userInfo!.setUserId(channelID)
}
}
// Observe the notification center event `UAChannelUpdatedEvent`
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(updateChannel)
name:UAChannelUpdatedEvent
object:nil];
// In the notification callback set the userID on your Movement SDK Manager instance
NSString channelID = [[UAirship push] channelID];
if (channelID) {
[FSQMovementSdkManager.sharedManager.userInfo setUserId:channelID];
}
Client Code: Android
On Android, associating a Foursquare Movement user identifier with an Airship channel should be
done inside a class extending AirshipReceiver
that implements its onChannelCreated
function. This is to ensure the channel ID is set immediately once it’s available.
private class MovementAirshipReceiver extends AirshipReceiver {
@Override
protected void onChannelCreated(@NonNull Context context, @NonNull String channelId) {
UserInfo userInfo = new UserInfo();
userInfo.setUserId(channelId);
MovementSdk.get().setUserInfo(userInfo);
}
Configuring the Foursquare Integration
In Airship:
- Go to Settings » Project Configuration and click Manage for Partner Integrations.
- Select Foursquare.
- Click Configure for the inbound integration and follow the onscreen instructions to:
- Create Custom EventsEvents that indicate that a user performed a predefined action, such as adding an item to a shopping cart, viewing a screen, or clicking an Unsubscribe button. Custom events can trigger automation, sequences, scenes, and surveys. You can code them into your app or website, or send them to Airship from an external source using the custom event API. Custom events contain
properties
that you can use to personalize messages. and an authentication token. Foursquare uses the token to communicate with your project in Airship. - Configure Airship as a third-party integration in Foursquare.
- Create Custom EventsEvents that indicate that a user performed a predefined action, such as adding an item to a shopping cart, viewing a screen, or clicking an Unsubscribe button. Custom events can trigger automation, sequences, scenes, and surveys. You can code them into your app or website, or send them to Airship from an external source using the custom event API. Custom events contain
Categories