Marc Lebel
Marc Lebel

Reputation: 61

Sharing a photo with text

The "Add a cat to that" example explains how to share a photo with my service.

But is there a way to share a photo with a text (using voice recorder) in a single item ?

Upvotes: 4

Views: 208

Answers (1)

mimming
mimming

Reputation: 13954

Yup! You can do this using the REPLY built-in menu item.

However, the flow is a bit different than the Add a Cat to That flow. It works like this:

  1. Subscribe to updates to the timeline collection.
  2. Insert a timeline item with the REPLY built in action specified as shown here. Optionally, you can rename the menu item and customize the icon.

    {
      "text": "Hello world",
      "menuItems": [
        {
          "action": "REPLY"
        }
      ]
    }
    
  3. The timeline card will have a reply option in its menu. When the user selects it, they will be prompted to speak.

  4. A new timeline card is then created which contains the text transcription and has an attached audio recording. Your Glassware has access to this card.
  5. Your Glassware is then notified about this item insertion. The notification looks something like this:

    {
      "collection": "timeline",
      "itemId": "3hidvm0xez6r8_dacdb3103b8b604_h8rpllg",
      "operation": "INSERT",
      "userToken": "harold_penguin",
      "verifyToken": "random_hash_to_verify_referer",
      "userActions": [
        {
          "type": "REPLY"
        }
      ]
    }
    
  6. Fetch the indicated timeline item to access the transcribed text (in the text property) and the attached audio recording

Upvotes: 3

Related Questions