Matthew Barker
Matthew Barker

Reputation: 638

Can't access unique identifier for Bixby using code from docs

To access a unique identifier for Bixby, I'm trying to access the contactId field within the contact library (which is also viv.self I think?). I tried using the code snippet found in the docs here, but I'm getting some errors.

Code Snippet (Source)

text (Name) {
  extends (contact.StructuredName)
}

Errors

ERROR: invalid capsule alias contact

ERROR: unknown super-type: contact.contactId


I would ultimately like to do something like this

integer (Identifier) {
  extends (contact.ContactId)
}

Would appreciate any help on accessing this data!

Upvotes: 2

Views: 291

Answers (1)

Matthew Barker
Matthew Barker

Reputation: 638

I ended up finding another way to get a device identifier from these docs. There's also a sample capsule here.


In your corresponding JavaScript file, access the $vivContext.locale parameter to return the locale information.

module.exports.function = function accessVivContext (dummyInput, $vivContext) {
  var result = "Testing Access vivContext..."

  // See docs for all the properties of $vivContext
  result = $vivContext.userId
  return result 
}

You would then need to configure your endpoints for this action like below, including making sure that you set up the proper accepted-inputs for your endpoint:

action-endpoint (AccessVivContext) {
  accepted-inputs (dummyInput, $vivContext) 
  local-endpoint ("AccessVivContext.js")
}

Upvotes: 2

Related Questions