2
votes

botframework Node.js [DirectLine 3.0 API / React Native Client (Android)] Events received by client websocket as a consequence of calling builder.Prompts.text() in a bot are missing the ‘data’ property (i.e. the activity payload).

Version Information

React Native Client (Android)

  • Node.js v7.5.0
  • react-native v0.41.2

Bot

  • Node.js v6.3.1
  • botbuilder v3.7.0

DirectLine

  • API v3.0

Description of Issue

Events received by client websocket as a consequence of calling builder.Prompts.text() in a bot are missing the ‘data’ property (i.e. the activity payload).

Note: Subsequent events following this one will include the Symbol ‘original_event’ which includes the missing event details that would have been expected in the initial event.

Direct Line request from bot (i.e. captured from ChatConnector.authenticatedRequest()):

{
  json: true,
  method: “POST”,
  url: “https://state.botframework.com/v3/botstate/directline/conversations/[MY CONVERSATION ID]”,
  body: {
    from: {
      id: “MyBot@ZSXyfFggVqW”,
      name: “MyBot”
    },
    recipient: {
      id: “MyClientId”
   },
    text: “Hi Pete, please enter the code displayed in the browser page to complete the sign in process.”,
    type: “message” 
  }         
}

Event received by websocket:

{
  … // Expecting a data property at this level. Don’t confuse this with the data property in the Symbol below, which is for the previous event.
  Symbol(original_event): {
    data: "{
      "activities": [
        {
          "type": "typing",
          "id": "[MY CONVERSATION ID]|5ChLjtMKBEz",
          "timestamp": "2017-05-04T10:37:48.3923201Z",
          "channelId": "directline",
          "from": {
          "id": "MyBot",
          "name": "MyBot"
        },
        "conversation": {
          "id": "[MY CONVERSATION ID]"
        }
      }
    ]}",
    type: ”message”
  },
  timestamp: 1493894269211,
  type: “message”
}

Event after the one above contains:

{
  …
  Symbol(original_event): {
    data: "{
    "activities": [
      {
        "type": "message",
        "id": "[MY CONVERSATION ID]|0000030",
        "timestamp": "2017-05-04T10:37:49.092354Z",
        "channelId": "directline",
        "from": {
          "id": "MyBot",
          "name": "MyBot"
        },
        "conversation": {
          "id": "[MY CONVERSATION ID]"
        },
        "text": "Hi Pete, please enter the code displayed in the browser page to complete the sign in process.”
      }
    ],
    "watermark": "30"
    }",
    type: ”message”
  },
  timestamp: 1493894511787,
  type: “message”
}

Notes:

• Notice that the event following the original has the data property we would have expected, contained in the Symbol “original_event”.

• If the same conversation thread is attempted for any other channel type, the message “Hi Pete, please enter the code displayed in the browser page to complete the sign in process” IS shown in the chat window (i.e. Skype, Slack, Web Chat etc). It is only direct line that appears to have the issue.

• The message in question is a proactive message triggered after a user has been authenticated and a redirect URL called. The message is required to prompt the user for a second form of authentication, in this particular case an access code.

• If all historic message activities are requested for the above conversation, the missing message is among said activities i.e.:

https://directline.botframework.com/v3/directline/conversations/[MY CONVERSATION ID]/activities?watermark=[INITIAL WATERMARK]

{
      "activities": [
            …
    {
      "type": "message",
      "id": "[MY CONVERSATION ID]|0000009",
      "timestamp": "2017-05-04T17:48:33.0747342Z",
      "channelId": "directline",
      "from": {
        "id": "MyBot"
      },
      "conversation": {
        "id": "[MY CONVERSATION ID]"
      },
      "text": "Hi Pete, please enter the code displayed in the browser page to complete the sign in process."
    }
…

Any suggestions?

Update 05/05/2017

Currently pursing two avenues of thought, either there is an issue with the WebSocket library bundled with React Native, or we have a general Direct Line WebSocket issue (a colleague of mine will be retesting with a native IOS client this morning to confirm one way or another).

1

1 Answers

0
votes

No longer an issue. Websocket events now appear to be coming through as expected.