Stream SDK Push Notification Paylaod - getstream-io

I am currently implementing Stream chat SDK in my react native app. When implementing push notifications, I was able to test and receive messages using stream chat:push:test --user_id command and actually sending messages in the app, but the payload I receive from Stream is always just
Here is the generic rendered notification payload that will be sent to
your devices: {
"sender": "stream.chat",
"type": "message.new",
"version": "v2",
"message_id": "88280bc0-23d6-43b9-b9e3-062b3a1a3dca",
"id": "88280bc0-23d6-43b9-b9e3-062b3a1a3dca",
"channel_type": "shellterChat",
"channel_id": "courseChatENES462JamesGreen202201",
"cid": "shellterChat:courseChatENES462JamesGreen202201" }
Currently, I am running client.getMessage() with the messageId from the payload to fetch the actual message, and display using Firebase Notifee, but this is problematic because I can't do the fetching when the app is at quit state (at index.js in my react native app). Am I missing something? Should the stream push payload include the actual message (including title, body, etc for push)? The document just says SDK will automatically handle it, which doesn't really make sense to me. Thank you for your help in advance.

React Native Firebase library provides a nice to handle background and quit state of the application as mentioned here - https://rnfirebase.io/messaging/usage#background-application-state

Related

MS Bot Framework Direct Line API 3.0: Get starting message

I published a bot using the Azure bot framework to the Azure cloud servers, and made an application that uses the Direct Line API 3.0 to send user responses and receive bot messages through HTTP requests. Everything works except that I'm not sure how to get the starting message of the bot at the start of the conversation. I open the conversation with the /v3/directline/conversations endpoint, but I'm not sure how to receive the first message of the bot (that is normally sent without any user interaction). A message request after opening the conversation doesn't include any bot responses, but the next message request after sending the first user input includes the first two messages of the bot (starting message and response to the user).
EDIT: From reading this I came to the conclusion that it will be easier to just use a custom event as a trigger for the welcome message. I updated my bot as follows to reflect this within bot composer, adding a new CUSTOM event trigger with a test response message:
However, I still can't seem to trigger this event via the Direct Line API. Currently, I send a request as follows, following the event activity structure:
{
"type": "event",
"channelId": "directline",
"from": { "id": "UnityUserId", "name": "Unity User 1" },
"value": "test",
"name": "welcome"
}
I then get a response with ID, normally indicating that the request was successfull. However, upon requesting the bot response messages, I get the following:
{
"activities": [
{
"type": "event",
"id": "5FZsHpWBxm1hjhWQYY7gr-eu|0000000",
"timestamp": "2022-04-09T14:39:15.90169Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "UnityUserId",
"name": "Unity User 1"
},
"conversation": {
"id": "5FZsHpWBxm1hjhWQYY7gr-eu"
},
"value": "test",
"name": "welcome"
}
],
"watermark": "0"
}
Indicating that the bot has no responses, which doesn't seem quite right when looking at the bot composer screenshot above. Is there something wrong with my current method?
Regards
The onMembersAdded event usually does the trick. Sample code is in https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-send-welcome-message?view=azure-bot-service-4.0&tabs=csharp
I thought I remembered seeing the bot's welcome message when using Direct Line, so I tried to quickly repro it again. I connected a simple echo bot via Direct Line. Then I created a conversation, sent a simple message, and then retrieved all activities (all via REST calls), and the bot's welcome message was indeed present in the response, as you can see in this screenshot:
Perhaps you should use these Direct Line 3.0 API reference docs as opposed to the one you linked above. I followed these steps using the basic Echo bot sample, Postman, and a bot resource in Azure for simple and easy testing, but you could use a full application if you wish.

I'm trying to receive a webhook from an Autodesk Forge workflow.transition event but they aren't firing

I've been experimenting with the Fusion Lifecycle webhooks in Forge and have been successful using the item created/updated events but the workflow transition webhooks aren't firing.
The webhooks are created in Forge according to the Docs, as you can see below, but none of the transitions performed in the workspace will trigger the call.
They were created using a three-legged token associated with a Fusion Lifecycle user that has the proper workflow permissions on the workspace.
The following JSON excerpt is the workflow. transition webhook as returned from developer.api.autodesk.com/webhooks/v1/hooks endpoint on Forge showing it was indeed created.
​
{
"hookId": "909fd040-4e34-11ea-a842-651c9013b5e8",
"tenant": "TENANTNAMEREMOVED4SO",
"callbackUrl": "callbackurl removed for SO",
"createdBy": "46FGNL6DBN6D",
"event": "workflow.transition",
"createdDate": "2020-02-13T07:43:45.988+0000",
"system": "adsk.flc.production",
"creatorType": "O2User",
"status": "active",
"scope": {
"workflow.transition": "urn:adsk.plm:tenant.workspace.workflow.transition:TENANTNAMEREMOVED4SO.119.1.765"
},
"hookAttribute": {
"creator": "D3 Forge Playground",
"notification": {
"class": "alert-danger",
"system": "flc"
}
},
"urn": "urn:adsk.webhooks:events.hook:909fd040-4e34-11ea-a842-651c9013b5e8",
"__self__": "/systems/adsk.flc.production/events/workflow.transition/hooks/909fd040-4e34-11ea-a842-651c9013b5e8"
}
I've pushed the workflow through the transition events numerous times and no webhook is being fired and no failed requests on our webhook receiving server either. if I mimic the payload for the workflow. transition event and post it to our endpoint, it is received as expected.
I have yet to see a live example of the workflow. transition webhook being fired and can't find any sample code from Autodesk using them. Not sure the service is even working as expected at this point even though the item.created and item.updated webhook events seem to work fine.
Has anyone successfully received a workflow. transition webhook from Autodesk Forge? If yes, could you provide some guidance on how?
Seems to be working fine on my end in a Production tenant. This is the payload I used to create the webhook:
{
"callbackUrl": "https://webhook.site/SOME_ID",
"scope": {
"workflow.transition": "urn:adsk.plm:tenant.workspace.workflow.transition:TENANT.107.1.421"
}
}
Does it look like the payload you used when creating the hook?
Greg, any chance you can try to trigger it again, and send me the date/time stamp with tenant name via a private message? I just tried it again in my Production tenant, and it seems to be working just fine when I perform the operation from both a v3 API call, and the UI. Feel free to file a support case if you want, too, and let me know the case number. I'd like to help you out here in understanding what's going on, because overall it looks OK from your side.

google nest hub can't play hls

My Question is
I push HLS steram to gnh(google nest hub) by action.devices.commands.GetCameraStream response format.gnh do nothing but show loading UI some seconds.
It's somthing wrong with my HLS file?
How to get log from gnh to help me debug?
As I know
I am tried to push mp4(1080p/under 60 fps) url to gnh, that's work well.
I am tried to convert mp4 to hls by some lib,include ffmpeg,Bento4.
Here is my JSON send to gnh:
{
"payload": {
"commands": [{
"status": "SUCCESS",
"states": {
"cameraStreamAccessUrl": "http:/path/of/steram.m3u8"
},
"ids": ["....."]
}]
},
"requestId": "My_Request_Id"
}
It seems that you are missing the required property cameraStreamSupportedProtocols. Try adding the protocol and see if you are able to get the stream to work. This will load the default cast camera receiver since you are trying to play HLS content. If you are still seeing an issue with playback, it could be that your stream is malformed and needs to be revised.
Playback logs will only be available to you if you create your own basic receiver app and specify this in your response using the cameraStreamReceiverAppId property. To see more about creating a cast receiver app refer to the overview page (https://developers.google.com/cast/docs/web_receiver) and how to create a basic receiver (https://developers.google.com/cast/docs/web_receiver/basic) for more information. We also do have a default camera receiver sample located in our sample github (https://github.com/googlecast/CastCameraReceiver)

Directline API message to Microsoft Bot

I have created the bot in azure services using LUIS, which used as chatbot and can create conversations using dialogs.
At some point, I am trying to push messages to chatbot using Direct Line API 3.0, I'm using Postman to send the messages to bot.
I followed the instructions from this page, https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-send-activity?view=azure-bot-service-4.0
I'm able to send message to the conversation as bot, below is the image I sent message from Postman and got successful response.
But my issue is, after the message is sent, the bot tries to analyse even though it's not user message. Bot starts to send message from default message handler like below,
Even after sending the message successfully, my bot triggers the default message handler, which is expected only to happen for user messages but not for bot messages.
Also, I have checked with webchat channel, which it doesn't trigger this default message handler. This is happening only in DirectLine API, can anyone help me on this.
Instead of sending the message as type "message", you should send it as "event".
This way your MessagesController will see it as an ActivityType of Event instead of Message and you can process however you want without spaghettifying your actual message handling
If you want to send different kinds of event to make it even easier, then you can 'name' you event by supplying the 'name' field with a value in your json.
Third, if you need to include data with the message, you would supply a value in the 'value' field of your json.
The github page for the standard webchat client has some great information on sending events. It might shed a bit more light on the json.
You can read more about the 'event' activity type here
You message json would look something more like this:
{
"type": "event",
"from": {
"id": "user1"
},
"name": "theEvent",
"value": "someDataMyBotNeeds"
}

ServiceWorker and Push Notification Payload

Community:
ServiceWorker is a great advance technology in terms of cache managment, but I have some questions associated with other operations such as:
Push Notification: I made a GCM integration (Google Clud Message) and NodeJS, following this article, the problem is that when GCM sends the information to the client (Chorme), the payload of the message generated by GCM is not accessible in the Notification in ServiceWorker Listener, which would be great for making decisions.
Any Idea when data payload in notifications will be enabled?
Registration: Since ES6 is very mature, it would be good to register a ServiceWorker in other ways, for example:
import sw from './sw.js'
navigator.serviceWorker.register(sw, {scope: '/'}).then(function (registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function (err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
Is this possible or make sense?
Thanks!!!!
The "Support encrypted payloads for push messages" bug tracks progress on getting payloads exposed in notifications. That bug is Chrome-specific, but other browser vendors are likely to follow the same approach.
The service worker upgrade flow is very much tied to the idea of there being a specific JavaScript file which represents the service worker's code, and that file can then be periodically checked, byte-by-byte, to see if there are any updates. If it were an in-memory JavaScript object that was registered, detached from the file, the upgrade flow wouldn't work as specified. I don't think you'll see the change you're proposing added to the specification.

Resources