Events received by client websocket as a consequence of calling builder.Prompts.text() in a bot are missing the activity payload - react-native

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).

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

Related

Netcore server respond to slack interactive message

I am trying to build Slack application with asp net core server. Currently, I have added Slash command which makes a request to my local server through ngrok. Once my server receives that request, it makes a post request to configured slack webhook to display interactive message which looks like pic from attachment.
I want user to be able to select yes or no and receive the result in my controller, but I can't realize how to tell Slack where should it make a post request. I attach the code of this message which is posted through weebhook into Slack:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This is a section block with a button."
}
},
{
"type": "actions",
"block_id": "actionblock789",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Yes"
},
"style": "primary",
"value": "yes"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "No"
},
"value": "no"
}
]
}
]
}
What I have in netcore is TestController with route /api/test which I suppose should receive from Slack a payload where information about selected button is set, but I couldn't find a way where specify a url in this json code.
You can not configure a URL in the JSON code. That is not how it works with the Slack API.
Slack will send all responses to interactive message - like when someone clicks on a button - to the configured request URL of your Slack app. Check out this link how to find that parameter: documentation

Why is "create" undefined for Edge extension notifications?

Running code in Edge extension throws a TypeError, unable to get property 'create' of undefined or null reference.
I have tried running it in both the popup and background scripts. I have the notifications permissions in the manifest. I did see that some APIs require being run in the content script, but since I'm not engaging the tabs or web pages, I don't think that applies to me...?
Manifest:
{
"name": "xxx",
"author": "xxx", "version": "1.1",
"options_page": "options.html",
"background": {
"scripts": ["jquery-3.3.1.min.js","background.js"], "persistent": true
},
"permissions": [
"xxx",
"background",
"notifications",
"storage"
],
"offline_enabled": true,
"browser_action": {
"default_title": "xxx",
"default_popup": "popup.html",
"default_icon": "32.png"
},
"manifest_version": 2
}
Background script:
try{
browser.notifications.create("test",{
"type": "basic",
"title": "Test",
"iconUrl": "48.png",
"message": "This is a test"
});
}catch(e){
alert(e);
}
Based on your description, first, you could try to upgrade the Edge browser to the latest version, then, try to use the browser.notifications.create method.
But, in my opinion, I prefer to display the notification using the Web Notifications API, you could check this article.

Creating an event through the ST Developer Portal's API Console

I'm trying to create an event using the API console and keep getting errors. Any ideas why?
I've been using different versions of the example value:
{
"name": "string",
"description": "string",
"status": "string",
"event_id": "string",
"start_epoch": 0,
"end_epoch": 0,
"industry": "string",
"archived": true,
"deleted": true,
"legacy_id": 0,
"is_public": true
}
I get the following back. Any thoughts?
{
"code": "BadRequestError",
"message": "[\"Has time can't be blank\",\"true is not included in the list\"]"
}
You will need to fetch the user/team information first
Once you have your oauth token from above and set to the Authorization header, make a call to https://developer-portal.socialtables.com/api-console#!/Authentication/get_4_0_oauth_token
This will give you the user and team object back to make subsequent calls to make events
Once you have the team_id you can now make events
You can POST to /4.0/events
Swagger doc: https://developer-portal.socialtables.com/api-console#!/Events/post_4_0_events
Example POST payload:
{
"name": "NAME",
"description": "DESCRIPTION",
"status": "new",
"start_epoch": TIME_IN_MS,
"end_epoch": TIME_IN_MS,
"industry": "INDUSTRY_TYPE",
“has_time”: 1 // 0 = all day event, 1 = from/to a specific time in day
}
- This will return the event ID under data.event.id in the response from the above POST
- You can then link the user to:
https://home.socialtables.com/events/EVENT_ID

How do I create an event using the SocialTables API?

I'm trying to use the /4.0/legacyvm3/teams/{team}/events endpoint to create an event. I'm running into some trouble with spaces.
I used the /4.0/legacyvm3/teams/{team}/venues endpoint to get a list of venues. I chose one to include in the spaces section and posted this:
{
"name": "Event via API Test 04",
"category": "athletic event",
"public": true,
"attendee_management": true,
"start_time": "2017-04-05T16:13:54.217Z",
"end_time": "2017-04-05T16:13:54.217Z",
"uses_metric": false,
"venue_mapper_version": 0,
"spaces": [
{
"venue_id": 128379,
"name": "Snurrrggggg"
}
]
}
The endpoint returns a 400 code and this error:
{
"code": 400,
"message": "Cannot read property 'toLowerCase' of undefined"
}
I tried including the wizard section, but each time it would return this error:
{
"message": "Access Denied to this feature"
}
After some experimentation, this body succeeded:
{
"name": "Event via API Test 03",
"category": "athletic event",
"public": true,
"attendee_management": true,
"start_time": "2017-04-05T16:13:54.217Z",
"end_time": "2017-04-05T16:13:54.217Z",
"uses_metric": false,
"venue_mapper_version": 0,
"spaces": [
{
"name": "Fake News Room"
}
]
}
But the application itself would not display the diagram, and the newly created room did not show up in my list of venues. Perhaps it did not assign permissions to it?
In any case, I don't actually want to create a new venue/space. I want to pass in an existing venue/space. How do I do that?
The short answer is to create a working diagram in 4.0 you will need to POST some data to the /4.0/diagrams endpoint.
The room you create doesn't map to the same concept as venues. When you create an event as you did, it creates a new space entity. The spaces endpoints can return information on those.

PushNotification -- no device found

I have a hybrid app and having some issue seeing notification..
I get the error
com.ibm.pushworks.server.exceptions.PushWorksException: FPWSE0009E: Internal server error. No devices found
I running on Local MFP (eclipse -- V7.1).. I see the device in the worklightconsole and the app is install on my phone (Xcode->phone via USB) and I see the opt-in notification message.. However, I get the error when I tried to send a push..
I am using postman and the restAPI
http://localhost:10080/worklightadmin/management-apis/1.0/runtimes/MyMobile/notifications/applications/myProj/messages
Here is the body of the post request
{
"message": {
"alert": "Test message"
},
"settings": {
"apns": {
"badge": 1,
"iosActionKey": "Ok",
"payload": {},
"sound": "song.mp3"
},
"gcm": {
"payload": {},
"sound": "song.mp3"
}
},
"target": {
"consumerIds": [],
"deviceIds": ["166CB698-45C2-4C61-9074-248EA4F8AA8F"],
"platforms": [
"A","G"
]
}
}
Can you give some hints to solve this issue ..
Thanks
As Vivin mentioned in the comments, your device ID may be wrong.
The same JSON works for me , in my local setup. Is it possible the device id you entered is wrong? With the current parameters within "target" you can get the error message only if the device id is wrong.