LogoLogo
  • A better way to do...stuff!
  • How we build the app
    • Overview
  • Documentation
    • Draftbit
      • Using Live Preview
      • Workspaces and Billing
      • Introduction to the Builder
      • Layout
      • Intro to Navigation
      • Fetching Data
      • Direct Integrations
      • FAQs
      • Draftbit
      • Draftbit
      • Custom Blocks
      • Borders, Background, and Elevation
      • Actions
      • Custom Screen Code
      • Exporting and Publishing Your Project
      • Sharing Your Project Online
      • Publishing Your App as a PWA
      • Stack Navigator
      • Tab Navigator
      • Draftbit
      • Draftbit
      • Basic
      • Media
      • REST Services & Endpoints
      • REST API Integrations
      • Themes & Styling
      • Submitting Data
      • Draftbit
      • Draftbit
    • Xano
      • resources-and-tips-1
        • 🎞️ Xano Video Tutorials
        • 🤝Community Corner
        • 💰Share Xano. Make money
      • FAQ
      • getting-started
        • ⚡ Jumpstart
        • 🎞️ The Xano Interface
      • instances
        • What is an Instance?
        • Early Access Instance
        • Upgrading an Instance
        • Sharing
        • Bandwidth Usage
        • API Rate Limit
      • What is a Workspace?
      • Dashboard
      • Database
      • Airtable Import
      • API
      • Library
      • Marketplace
      • Settings
      • authentication
        • Authentication
        • Sign-up & Log in
      • data-manipulation
        • The Function Stack
        • Addons (GraphQL-Like)
        • The Expression Builder
        • External Query Manipulation
        • Timestamp
        • Filters
        • Images
    • Expo
      • Creating your first build - Expo Documentation
    • Kommunicate
      • Installation
      • Installation
      • Installation
      • Installation
      • Installation
      • Flutter Installation
      • Installation
      • Zapier Integration
      • Authentication
      • CMS Installation
      • Authentication
      • Conversation
      • Conversation Assignment
      • Customization
      • Localization
      • Logout
      • Web Troubleshooting
      • Installation
      • Authentication
      • Push Notification
      • Conversation
      • Customization
      • Localization
      • Logout
      • Installation
      • Authentication
      • Push Notification
      • Conversation
      • Customization
    • Formito
      • basics
        • Getting Started
        • Variables
        • Are you GDPR ready?
        • How to prefill the values of my chatbot?
      • connect
        • How to connect Formito to Zapier?
      • convert
        • How to convert old formito chatbots to the new version?
        • How to convert Google Forms into a chatbot?
        • How to convert a Monday.com board to a chatbot?
        • How to create chatbot from QuickBase table?
      • guide
        • How to add my chatbot to WordPress?
        • How to create a chatbot for Zendesk?
      • shopify
        • How to embed my chatbot into a Shopify page?
        • How to display Formito chatbot on bottom corner of my Shopify store?
        • How to open my chatbot after clicking on links or buttons?
    • Stonly
  • Flex Stuff
    • App
    • APIs
    • Database
    • Website
    • Design
    • Style Guide
  • Content
    • Guides
    • ChatBots
    • Blogs
    • Whitepapers
  • Company
    • About us
    • Brand
    • Roadmap
    • Policies
  • Flex Together
    • Overview
    • Fair Finance
Powered by GitBook
On this page
  • Setup
  • Registration/Login
  • 1. Visitors
  • 2. Pre chat Lead Collection
  • 3. Registered User
  • Register User
  • Passing on additional details as metadata
  • What Next?

Was this helpful?

  1. Documentation
  2. Kommunicate

Authentication

PreviousInstallationNextPush Notification

Last updated 4 years ago

Was this helpful?

Setup

There is a setup call that you need to do before registration or login. You can get your by signing up on . In your AppDelegate, first import Kommunicate:

import Kommunicate

Then, in the application:didFinishLaunchingWithOptions: method, setup Kommunicate as shown below

Kommunicate.setup(applicationId:)

In case of 'no such module' error, check the following troubleshooting intsruction:

Once you complete the pod installation, close the project and open .xcworkspace file then build the project to avoid the above mentioned error.

Registration/Login

Convenient methods are present in Kommunicate class to register a user on Kommunicate.

Currently we support two different types of users on our iOS SDK:

1. Visitors

A random Id will be assigned as an userId if you don't have any information about the users. So first get the userId for an anonymous user as described below and, pass the same in .

let userId = Kommunicate.randomId()

Note: The above line should be passed in the registration process.

You don't have to store this id on your side. In the section, we show how to check if the user is already logged in.

2. Pre chat Lead Collection

For collecting user contact information before initiating the chat, show the Pre chat view like this:

let preChatVC = KMPreChatFormViewController(configuration: Kommunicate.defaultConfiguration)
preChatVC.delegate = self 
self.present(preChatVC, animated: false, completion: nil) 

Confirm your ViewController to the KMPreChatFormViewControllerDelegate to get the callbacks when a user taps the submit or close button:

extension ViewController: KMPreChatFormViewControllerDelegate {

    func userSubmittedResponse(name: String, email: String, phoneNumber: String) {
        self.dismiss(animated: false, completion: nil)
        
        
        
    }

    func closeButtonTapped() {
        self.dismiss(animated: false, completion: nil)
    }
}

3. Registered User

If the user is logged in your app then you can pass the user information in this way.


let userId = unique key>
let emailId =  

Register User

To register a user to the Kommunicate server, use below method from Kommunicate class:

Create a KMUser object and pass it to the registerUser method:

let kmUser = KMUser()
kmUser.userId = userId
kmUser.displayName = displayName
kmUser.email = emailId // Optional
kmUser.applicationId = 

// Use this same API for login
Kommunicate.registerUser(kmUser, completion: {
    response, error in
    guard error == nil else {return}
    print("Success")
})

Passing on additional details as metadata

Sometimes, you may need to pass additional details for the user apart from the already existing properties of KMUser. You can pass the additional details in metadata of the KMUser object.

// This is example data. You can set it according to the additional details you want to add
let userMetadata = NSMutableDictionary()
userMetadata["department"] = "Engineering"
userMetadata["designation"] = "Software Engineer"
userMetadata["team"] = "Device Team"

kmUser.metadata = userMetadata

To check if user is already logged in, use below API:

if Kommunicate.isLoggedIn {
  // User is already logged in
}

Note: To avoid calling in registration everytime use isLoggedIn to check if the user is already logged in or not.

What Next?

Pre chat view screenshot

Check out the where you will get the details for creating and launching a conversation.

to get real-time updates.

APP_ID
Kommunicate dashboard
user registration
user registration
Conversation Section
Enable Push Notifications