IMS SDK Product Document
  • Getting Started
    • iOS
      • Requirements
      • Importing the SDK
      • Permissions
      • Initializing the SDK
      • Using the SDK
        • Using Push Notifications
          • Push notification certificate and profile creation guide
    • Android
      • Requirements
      • Import the SDK
      • Permissions
      • Obfuscation
      • Initialize the SDK
      • Using the SDK
        • Trip Detection and Recording
          • Trip Manager Configuration
            • Using TripDetector.AWARENESS
            • Trip Manager Device Support
          • Trip Manager Control
          • Trip Manager Status
        • Bluetooth and Other Devices
    • React Native
      • Requirements
      • Import the SDK
      • Permissions
      • Initialize the SDK
        • Android
        • iOS
      • Using the SDK
        • Trip Manager
        • Device service
    • Flutter
      • Requirements
      • Import the SDK
      • Permissions
      • Initialize the SDK
      • Using the SDK
  • Security
  • App misuse
  • Time Driven Without Phone
  • DriveSync Portal
    • Requirement
    • User
    • Device
    • Driving Alert
    • Push Notification
    • Invitations
    • Subscription
    • Trip
    • Location
    • Driving Summary
    • Discount
    • Scoring
    • Vehicle
    • Leaderboard
    • Rewards
    • Submit consent to EULA
    • Legal documents and FAQ
    • Named Driver
    • Wedge
  • Known Issues
    • iOS
    • Android
      • 1.17.0
      • 1.18.0
      • 1.22.0
  • Releases
    • 1.13.0
      • iOS
      • Android
    • 1.14.0
      • Android
    • 1.15.0
      • iOS
      • Android
    • 1.15.1
    • 1.16.0
      • iOS
      • Android
    • 1.17.0
      • iOS
      • Android
    • 1.18
      • iOS
      • Android
    • 1.18.1
    • 1.19.0
      • iOS
      • Android
    • 1.20.0
      • Android
      • iOS
    • 1.21.0
      • Android
      • iOS
    • 1.22.0
      • Android
      • iOS
    • 1.23.0
      • Android
      • iOS
    • 1.24.0
      • Android
      • iOS
    • 1.24.1
      • iOS
  • Migration
    • iOS
      • 1.15.x -> 1.16.0
      • 1.16.0 -> 1.17.0
      • 1.17.0 -> 1.18.0
      • 1.18.0 -> 1.19.0
      • 1.19.0 -> 1.20.0
      • 1.20.0 -> 1.21.0
      • 1.21.0 -> 1.22.0
      • 1.22.0 -> 1.23.0
      • 1.23.0 -> 1.24.0
      • 1.24.0 -> 1.24.1
    • Android
      • 1.15.x -> 1.16
      • 1.16 -> 1.17
      • 1.17 -> 1.18
      • 1.18 -> 1.19
      • 1.19 -> 1.20
      • 1.20 -> 1.21
      • 1.21 -> 1.22
      • 1.22 -> 1.23
      • 1.23 -> 1.24
  • Support
Powered by GitBook
On this page
  • Primary Driver Send Invitation to Secondary Driver
  • Concrete example
  • Remove secondary user from FAMILY ACCOUNT
  • Concrete example
  • Concrete example
  • Retrieve Pending Invitations
  • Concrete example
  • Respond to Pending Invitation
  • Concrete example
  • Cancel Pending Invitation
  • Required information
  • Concrete example
  1. DriveSync Portal

Invitations

Handles Invitation related requests with IMS web services.

Primary Driver Send Invitation to Secondary Driver

The SDK allows for the host application to enable the primary driver to send invitations to any secondary driver based on VEHICLE or FAMILY ACCOUNT.

Concrete example

Sending invitation based on account

To send the invitation, the following API can be used.In this example we send an invitation based on ACCOUNT.

let invitationService = InvitationService()
invitationService.sendAccountInvitation(fromUserID: fromUserID,
                                        toUserFirstName: toUserFirstName,
                                        toUserLastName: toUserLastName,
                                        toUserEmail: toUserEmail,
                                        toUserPhoneNumber: toUserPhoneNumber,
                                        fromAccountIds: fromAccountIDs, then: { result in
    switch result {
    case .success(_):
        // invitation successful
    case .failure
        // error
    }
})
val service = InvitationService()
service.sendAccountInvitation(fromUserId,
                              fromAccountIds,
                              toUserFirstName,
                              toUserLastName,
                              toUserPhoneNumber,
                              toUserEmail) { result: Result<List<Invitation>> ->
    if (result?.value == null || result.throwable != null) {
        // failure
    } else {
        // Success
        val response = result.value
        completionHandler(content)
    }
})

Sending invitation based on vehicle

To send the invitation based on VEHICLE you need to provide vehicleIds field instead of fromAccountIds and call sendVehicleInvitation.

let invitationService = InvitationService()
invitationService.sendVehicleInvitation(fromUserID: fromUserID,
                                        toUserFirstName: toUserFirstName,
                                        toUserLastName: toUserLastName,
                                        toUserEmail: toUserEmail,
                                        toUserPhoneNumber: toUserPhoneNumber,
                                        vehicleIDs: vehicleIDs, then: { result in
    switch result {
    case .success(_):
        // invitation successful
    case .failure
        // error
    }
})
val service = InvitationService()
service.sendVehicleInvitation(fromUserId,
                                vehicleIds,
                                toUserFirstName,
                                toUserLastName,
                                toUserPhoneNumber,
                                toUserEmail){ result ->
        if (result?.value == null || result.throwable != null) {
            // failure
        } else {
            // Success
            val response = result.value
            completionHandler(content)
        }
}

Remove secondary user from FAMILY ACCOUNT

The guest driver can be removed from the Family Account.

Removing secondary user based on account

To remove secondary guest driver based on account, the following API can be used.

Concrete example

let service = InvitationService()
service.removeGuestDriverFromAccount(toUserId: userID,
                                     accountId: accountID, then: { result in
    switch result {
    case .success(_):
        // successfully removed
    case .failure
        // error
    }
})
val service = InvitationService()
service.removeDriverFromAccount(userId,
                                accountId) { result ->
        if (result?.value == null || result.throwable != null) {
            // failure
        } else {
            // Success
            val response = result.value
            completionHandler(content)
        }
}

Removing secondary user based on vehicle

To remove secondary guest driver based on vehicle, the following API can be used.

Concrete example

let service = InvitationService()
service.removeGuestDriverFromVehicle(toUserId: userID,
                                     vehicleId: vehicle, then: { result in
    switch result {
    case .success(_):
        // successfully removed
    case .failure
        // error
    }
})
val service = InvitationService()
service.removeDriverFromVehicle(userId,
                                vehicleId){ result ->
        if (result?.value == null || result.throwable != null) {
            // failure
        } else {
            // Success
            val response = result.value
            completionHandler(content)
        }
}

Retrieve Pending Invitations

The host application can retrieve pending invitations. The list contains all invitations that the user has sent or received, so apps should check the primaryDriver and secondaryDriver ID's to see if the current user sent (primary) or received (secondary) each one.

Pending Account Invitations

To retrieve the pending account invitations, the following API can be used.

Concrete example

let service = InvitationService()
service.fetchAccountInvites(then: { result in
    guard !result.value?.isEmpty else {
        // failure
        return
    }
    completionHandler(.success(result.value))
})
val service = InvitationService()
service.fetchInvitations(userId) { result: Result<InvitationResponse?>? ->
    if (result?.value == null || result.throwable != null) {
        // failure
    } else {
        // Success
        val response = result.value
        completionHandler(content)
    }
})

Pending vehicle Invitations

To retrieve pending vehicle invites, the following API can be used.

let service = InvitationService()
service.fetchVehicleInvites(then: { result in
    guard !result.value?.isEmpty else {
        // failure
        return
    }
    completionHandler(.success(result.value))
})
val service = InvitationService()
service.fetchVehicleInvitations(userId) { result: Result<InvitationResponse?>? ->
    if (result?.value == null || result.throwable != null) {
        // failure
    } else {
        // Success
        val response = result.value
        completionHandler(content)
    }
})

Respond to Pending Invitation

The host application can accept or decline pending invitations.

Accepting an invitation

To accept an invitation, the following API can be used.

Concrete example

let service = InvitationService()
service.respondToInvitation(toUserId: toUserId,
                            invitationId: invitationId,
                            response: .accept, then: { result in
    switch result
    case .success(_):
        // response successful
    case .failure(_):
        // error
})
val service = InvitationService()
service.respondInvitation(invitation,
                          Invitation.Response.ACCEPT) { result: Result<Any> ->
    if (result.throwable != null) {
        // failure
    } else {
        // Success
    }
})

Declining an invitation

To decline an invitation, the following API can be used.

let service = InvitationService()
service.respondToInvitation(toUserId: toUserId,
                            invitationId: invitationId,
                            response: .decline, then: { result in
    switch result
    case .success(_):
        // response successful
    case .failure(_):
        // error
})
val service = InvitationService()
service.respondInvitation(invitation,
                          Invitation.Response.DECLINE) { result: Result<Any> ->
    if (result.throwable != null) {
        // failure
    } else {
        // Success
    }
})

Cancel Pending Invitation

The host application can cancel pending invitations.

Required information

  • UserId: Only the user who sent the invitation can cancel it.

To cancel to an invitation, the following API can be used.

Concrete example

let service = InvitationService()
service.cancelVehicleInvitation(fromUserId: fromUserId,
                                invitationId: invitationId,
                                then: { result in
    switch result
    case .success(_):
        // cancel successful
    case .failure(_):
        // error
})
val service = InvitationService()
service.cancelInvitation(invitation) { result: Result<Any> ->
    if (result.throwable != null) {
        // failure
    } else {
        // Success
    }
})
PreviousPush NotificationNextSubscription

Last updated 5 months ago