2

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!

Matthew Barker
  • 638
  • 9
  • 13
  • This might be a super basic question but: Have you imported the viv.contact library capsule into your capsule by adding it to your `capsule-imports`? – Ameya Apr 05 '19 at 20:23

1 Answers1

2

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")
}
Matthew Barker
  • 638
  • 9
  • 13