Skip to main content

Askribe iOS SDK

Askribe iOS SDK enables you to show questionnaire directly from your own mobile app.

SDK integration (Requires Deployment Target 9+)

Setup

Download the sample project which contains the Swift library.

Obtain the API key required to connect with Askribe servers from the Settings section in your Askribe questionnaire dashboard.

Displaying the survey

showQuestionnaire(askribeParams: askribeParams)

See the below section for a discussion on params

Params

AskribeParams has the following fields:

  • askribeKey
    • Type: String
    • Required
    • Obtain the API key required to connect with Askribe servers from the Settings section in your Askribe flow dashboard.
  • configId
    • Type: String
    • Required
  • context
    • Type: [String: VariableData]
    • Optional
    • Description: Pass a list of Key-Value pairs to be substituted in the flow
  • receiversEmailAddress
    • Type: String
    • Required if distributionType is AUTO_EMAIL
  • receiversPhoneNumber
    • Type: String
    • Required if distributionType is one of AUTO_SMS | AUTO_WHATSAPP | AUTO_VOICE
  • slackUserId
    • Type: String
    • Required if distributionType is AUTO_SLACK
  • webPushConfig
    • Type: ContactWebPushConfig
    • Required if distributionType is AUTO_PUSH_NOTIFICATION
  • androidPushConfig
    • Type: ContactAndroidPushConfig
    • Required if distributionType is AUTO_ANDROID_PUSH_NOTIFICATION
  • iOSPushConfig
    • Type: ContactIOSPushConfig
    • Required if distributionType is AUTO_IOS_PUSH_NOTIFICATION
  • language
    • Type: String
    • Optional
    • Description: Use this parameter to set the language of the flow
  • Callback
    • Type: () -> void
    • Optional
    • Description: Pass a function to be called when the questionnaire is finished.
class VariableData: Codable {
var contextVariableType: ContextVariableType? = nil
var value: String? = nil
}
class CategoryValue: Codable {
var label: String? = nil
var value: String? = nil
}
class ContextVariableType: Codable {
var variableType: String? = nil
var categoryValues: Array<CategoryValue>? = nil
var nluEntityId: String? = nil
var blueprintId: String? = nil

var t1Type: ContextVariableType? = nil
var t2Type: ContextVariableType? = nil

}
class ContactAndroidPushConfig: Codable{
var fcmId: String? = nil
}
class ContactIOSPushConfig: Codable{
var apnsId: String? = nil
}
class ContactWebPushConfig: Codable{
var urlEndpoint: String? = nil
var key: String? = nil
var auth: String? = nil
}

Integrating Push Notifications

To setup push notifications for your app:

  • Register for push notifications - Register for push notifications by calling AskribeSDK.registerForPushNotifications(cdpId: String)
  • Enrich the contact, optionally - You can enrich the contact created in the above step by calling AskribeSDK.enrichContact(_ contactEnrichmentDTO: ContactEnrichmentDTO)
  • Check the sample app - Check the sample app to see how to do custom configuration for notification clicks, action items, etc.

ContactEnrichmentDTO has the following properties:

var email: String? = nil; // Email Id of the user
var phone: String? = nil; // Phone Number of the user
var app: String? = nil; // Name of your app
var appUserId: String? = nil; // Id of the user in your app
var customFieldValues: Dictionary<String, String> = [:]; // Values for predefined custom fields
var cdpId: String? = nil; // ID of the cdp where you want to enrich the contact. This field is mandatory