Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Go to Haptik Website
  • Contact Us
  • Home
  • Deployment
  • Android SDK

Signup and Authentication on Android SDK

Written by Soham Amburle

Updated on December 13th, 2023

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting Started
    Build Deploy Analyse Manage Account Bot Deactivation
  • Bot Building
    Essentials Smart Skills Steps User Messages Bot Responses Entities Connections Customisations User feedback collection Testing Whatsapp Bots NLU Bot Maintenance
  • Smart Agent Chat
    Set up Admin Settings MyChats Section (Agent Inbox) Live Traffic Section Teams Section Archives Section Analytics Plans on Smart Agent Chat
  • Conversation Design
    Design Basics Design Guides Designing for Platforms Designing WhatsApp Bots
  • Developer Guides
    Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
  • Deployment
    Web SDK WhatsApp Facebook Instagram Sunshine Conversation LINE Google Business Messages Telegram MS Teams Bot as an API iOS SDK Android SDK
  • External Agent Tool Setup
    Zendesk Chat Salesforce Service Cloud Freshchat Zoho NICE CXOne Gorgias
  • Analytics & Reporting
    Intelligent Analytics
  • Notifications
    SMS Notifications Success Measurement
  • Commerce Plus
    Catalog Integration Bot Building Guide Channel Deployments Unified ML Pipeline Documentation
  • Troubleshooting Guides
    Error Messages FAQs
  • Release Notes
+ More

Table of Contents

1. Guest Signup 2. Custom signup

Haptik SDK supports two types of user authentication:

1. Guest Signup

SDK creates a new user, without any specific details.

Kotlin Code:

fun launchGuestConversation() {
    HaptikSDK.loadGuestConversation(callback = { 
        if (it.status) { 
            Toast.makeText(context, "Launch successful", Toast.LENGTH_LONG).show() 
        } else { 
            Toast.makeText(context, "Failure : ${it.message}", Toast.LENGTH_LONG).show() 
        }
    })
}

Parameter:

- callback(Optional): This callback will notify you if the conversation was launched successfully or not. You will receive the status(boolean) and message(String) in the callback response parameter.

Java Code:

Public void launchGuestConversation(){
    HaptikSDK.INSTANCE.loadGuestConversation(callback -> { 
        if (callback.getStatus()) {
            Toast.makeText(context, "Launch successful", Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(context, "Failure : " + callback.getMessage(), Toast.LENGTH_LONG).show();
        }
    });
}

Parameter:

- callback(Optional): This callback will notify you if the conversation was launched successfully or not. You will receive the status(boolean) and message(String) in the callback response parameter.

2. Custom signup

For cases when the client/parent application already has a signup flow in place and wants to link the same user to the SDK. Prepare SignupData object with required data and pass it to Haptik SDK.

Kotlin Code:

fun launchCustomSignupConversation() {
    val signupData = SignupData().apply {
        authCode = "YOUR_AUTH_CODE"
        authId = "YOUR_AUTH_ID"
        signupType = "third_party"
        customData = JSONObject().apply {
            put("custom-data-one", "date-one")
            put("custom-data-two", "data-two")
        }
    } 
    HaptikSDK.loadConversation(signupData, callback = { 
        if (it.status) {              Toast.makeText(context, "Launch successful", Toast.LENGTH_LONG).show()          } else {              Toast.makeText(context, "Failure : ${it.message}", Toast.LENGTH_LONG).show()          }     }) }

- callback(Optional): This callback will notify you if the conversation was launched successfully or not. You will receive the status(boolean) and message(String) in the callback response parameter.

Java Code:

public void launchCustomSignUpConversation(){
    SignupData signupData = new SignupData();
    signupData.setAuthCode("YOUR_AUTH_CODE");
    signupData.setAuthId("YOUR_AUTH_ID");
    signupData.setSignupType("third_party");
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("custom-data-wrapper-one", "data-one");
    jsonObject.put("custom-data-wrapper-two", "data-two");
    signupData.setCustomData(jsonObject);
    HaptikSDK.INSTANCE.loadConversation(signupData, callback -> {
        if (callback.getStatus()) {             Toast.makeText(context, "Launch successful", Toast.LENGTH_LONG).show();         } else {             Toast.makeText(context, "Failure : " + callback.getMessage(), Toast.LENGTH_LONG).show();         }     }); }

- callback(Optional): This callback will notify you if the conversation was launched successfully or not. You will receive the status(boolean) and message(String) in the callback response parameter.

SignupData Options:

  • authId <String> : User Identifier [Mandatory]
  • authCode <String> : Authorisation Token [Mandatory]
  • signupType <String>:  Type of singup. Please connect with your Haptik SPOC for this[Mandatory]
  • username <String> : The name of the signed in user[Optional]
  • email <String> : Email id of signed in user[Optional]
  • mobileNo <String> : Mobile number of signed in user[Optional]
  • customData <Object> : Arbitrary key value data that the client needs to send[Optional]
Delete

Points to note: 

1. You have to call:

HaptikSDK.loadGuestConversation() or HaptikSDK.loadConversation(signupData) every time you want to take users to the conversation screen. If the user is not logged in, HaptikSDK will perform the signup and open the conversation screen. If the user is already logged in, HaptikSDK will simply open the conversation screen.

2. Check if the Verification Endpoint has been added. Click here for better understanding.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Customization on Android SDK

Platform

  • Conversation Studio
  • Smart Skills
  • Advanced NLU
  • Intelligent Analytics
  • Omnichannel
  • Smart Agent Chat
  • Enterprise Security
  • Integrations

Solutions

  • Conversational Commerce
  • Lead Generation
  • Customer Care
  • WhatsApp
  • Conversational IVR
  • Google Business Messages

Industries

  • Retail/ E-Commerce
  • Financial Services
  • Travel & Hospitality
  • Telecom

Knowledge

  • ROI Calculator
  • Reports & Research
  • Case Studies
  • Webinars
  • ISAT
  • Tech Blog
  • Business Blog
  • Resources
  • Haptik v/s Yellow
  • Haptik v/s Liveperson
  • Haptik v/s IBM Watson
  • Haptik v/s Verloop
  • Conversations on AI

Company

  • Why Haptik
  • About Us
  • Careers
  • News & Media
  • Awards & Recognition
  • Contact Us
  • Partnerships
  • Investor Relations

Subscribe

Sign up to recieve the latest updates

Find us on

  • Twitter-footer
  • Linkedin-footer
  • YT-footer
  • Insta-footer
  • G2-footer
  • Facebook-footer

Knowledge Base Software powered by Helpjuice

Copyright © jio Haptik Technology Limited 2021 | Data Security & Privacy Policy | GDPR

North America | Asia Pacific | Africa | enterprise@haptik.ai

Definition by Author

0
0