Reputation: 356
I'm try to integrate intercom live chat feature into my app, the live chart platform shows as below but could not load the chart features.
Also, I get this error in the logcat:
E/Intercom: Api call failed: {“type”:“error.list”,“request_id”:“0009rulecss011cdfe60",“errors”:[{“code”:“token_not_found”,“message”:“Unauthorized”}]}
Here are my implementations so far:
class App : MultiDexApplication() {
override fun onCreate() {
super.onCreate()
initIntercom()
}
private fun initIntercom(){
Intercom.initialize(this, getString(R.string.intercom_api_key), getString(R.string.intercom_app_id))
}
}
The fragment where I want to open the chat
class IntercomLiveChatFragment : Fragment() {
private val USER_ID = "123456"
private val CLIENT_ID = "client-id"
private val SECRET_ID = "secret-id"
//----------------------------------------------------------------------------------------------
// If you use Identity Verification you will need to include HMAC
// We suggest taking these values from your app. You may need to change USER_ID above to match your HMAC
//----------------------------------------------------------------------------------------------
private val YOUR_HMAC = ""
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.intercom_live_chat_fragment, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
//Enable a user wit Intercom
Intercom.client().setLauncherVisibility(Intercom.Visibility.VISIBLE)
//Register a user with Intercom
Intercom.client().registerIdentifiedUser(Registration.create().withUserId(SECRET_ID))
Intercom.client().updateUser(userAttributes)
Intercom.client().displayMessenger()
}
}
I passed CLIENT_ID as well for the withUserId(CLIENT_ID)
but still getting the same error. I am yet to know what exactly is the UserId add if that is what is causing the error. Please help me out.
Upvotes: 1
Views: 699
Reputation: 1
https://developers.intercom.com/installing-intercom/docs/android-identity-verification As it appears here in the official docs, if you log in with Identified user, you also need to provide the hash:
Intercom.client().setUserHash("your_hmac_of_user_id_or_email");
Upvotes: 0