Notification and Communication

Pre-requisite

  • The user has to be signed in to perform the following operations.
  • The user should have an active pro-monitoring plan activated on the space.

Setting OTP to validate the user

To send an otp to a users phone to validate, The following method can be used:

  • spaceId (required): The space id of the User.
  • request (required): The request object containing the phone number
val request = SecurityPhoneNumber(
  code = "+1",
  value = "123123123123"
)
InstaVision.securityServices.sendOtp(
  spaceId = "spaceId",
  request = request,
  onSuccess = {
    // OTP sent to the phone successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)

Updating the user’s Phone Number

To the users phone number which would be used for pro-monitoring, The following method can be used:

  • spaceId (required): The space id of the User.
  • request (required): The request object containing the phone number
val request = SecurityPhoneNumber(
  code = "+1",
  value = "123123123123",
  otp = "123123"
)
InstaVision.securityServices.updatePhoneNumber(
  spaceId = "spaceId",
  request = request,
  onSuccess = { 
    // The number has been updated
  },
  onError = { error ->
    // The error object contains the error code and message
  }
)