How to send text messages in Jitsi? - chat

I'm developing a standard video call application using Jitsi; I want an additional feature to let the other party know something lik "I'll be late a few minutes"
Jitsi has a built-in text chatting; but I don't know how it can be used outside the Jitsi call.

You can develop with "external_api.js". when current user joined the video jitsi triggers
participantJoined - event notifications about new participants who
join the room. The listener will receive an object with the following
structure:
api.on(‘participantJoined’, (object) => join(object.id));
resource
method will be triggered for each participant. Collect and store the participant "id"'s from there. Then use
sendEndpointTextMessage - Sends a text message to another participant
through the datachannels.
api.executeCommand('sendEndpointTextMessage', 'receiverParticipantId', 'text');
resource2
this method for sending messages for each participant.
You can develop with "lib-jitsi-meet"(lib-jitsi-meet) library and then you can use "sendTextMessage(text)" function.

Related

Conversation flow works in 'Try it out' but skips child node in app

I am making an app that predicts clothes the user is wearing. It uses the Visual Recognition tool, too, and for Conversation and VR to be communicating, I attach the intent 'suggestClothing' or 'clothResult' to the cloth items it found. I use an entity for Conversation to recognize the cloth items and respond accordingly.
The flow should be as follows:
User: how do I look?
-classifies clothes-
App to conversation: clothSuggest blackJacket
Conversation to user: "You picked the black jacket! Try out the green shirt with this outfit and show me how you look."
-classifies clothes-
App to conversation: clothResult blackJacket greenShirt
Conversation to user: "You look great in that outfit!"
All nodes have multiple responses as all clothes are in pairs. Either the user is wearing one or the other, and Conversation will then always suggest it's match.
Conversation flow looks like this
I also attempted this. Here sq123 is suggestClothing (first intent) and cq123 is clothResult:
This works fine in 'Try it out', too, but in the app, it immediately exits the branch on 'clothResult item1 item2' and matches with other conditions in the app.
What's the best way to optimize my flow to make it work in the app?
A typical reason why it works in "Try it out" and not in the app is that the context object is not returned properly.
When the app invokes the message method of the Watson Assistant API, a context object is passed. The calls are stateless and everything needed for Watson Assistant to continue a dialog is included in the context object. Thus, when your app retrieves the results from the message API, it needs to save the context and pass it back to Watson Assistant the next time the message method is invoked again (for that session and user).

MS Bot framework i want to put a form builder in an open conversation

I want to start Form conversation chat in Microsoft Bot framework.
if(user says hello)
{
reply = what u want to listen hi or hello
if(user says order)
{
reply= start a formbuilder.form with order form workflow
}
if(user says hello)
{
reply= hello
}
}
My problem is the first thing i do always works
example: if i say first chat line as order it starts order form but it never goes to the normal conversation mode even if the form ends.
if i start hi then it always goes in hi mode never goes or create order form on typing order.
Need it to be dynamic
you can use below code to end your conversation when you are in a dialog or a conversation flow ends.
context.Done<object>(new object());
or
context.Done(true);
do let me know if you need any help further
Per my understanding, you want start specific dialogs while triggering different words like "hollo" for greeting dialog, "order" for form dialog.
I think there are two methods to achieve this in C#:
You can leverage Recognize intents to implement LUIS, which can identify your users' intent from their spken or textual input, or utterances. Trigger specific dialogs for each LUIS intent.
For this solution you can refer to the official document Recognize intents and entities with LUIS using a prebuilt domain for details, and refer to https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/intelligence-LUIS for a sample for your reference.
You also can build Global message handlers using scorables in your bot application for yourself. With which, you can route users to certain fuctionality by using words like "help," "cancel," or "start over" in the middle of a conversation when the bot is expecting a different response.
Please refer to https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-GlobalMessageHandlers for the sample for this solution.
Hope it helps.

How to receive cumulocity real time notifications with SmartREST?

We use the cumulocity REST API. Regular real time notifications work, e.g. we subscribe to /alarms/*, start our connection/polling loop and when we create an alarm we receive the expected JSON. We did not install any specific modules or statements, it just works.
But when we try to do the same with SmartREST we receive this error, as soon as the alarm is created:
40,,/alarms/177649296,Could not find any templates subscribed for the channel
Following the reference guide (http://cumulocity.com/guides/reference/smartrest/) we tried it like this, where all requests have the same X-Id-header and all requests result in the expected http status 200 and no error messages, except for the last one:
Register a smart response template by doing a POST to /s
Body: 11,102,,,$.channel
Handhake: POST to /cep/realtime
Body: 80
Response is our clientId (e.g. 191het1z38bp7iq1m96jqqt8jnef)
Subscribe: POST to /cep/realtime
Body: 81,191het1z38bp7iq1m96jqqt8jnef,/alarms/*
Connect: POST to /cep/realtime
Body: 83,191het1z38bp7iq1m96jqqt8jnef
In the normal REST case the notification consists of a JSON array with 2 elements, both of which have a property "channel". So that is what we would expect from our response template. Instead, we get the aforementioned error 40.
Is our response template wrong? Is it not properly matched by the X-Id? What does it mean, that there are no "templates subscribed for the channel"? The subscriptions are done for a clientId, and not for a specific response template, and the templates are supposed to be matched automatically anyway. So probably "template" means "X-Id" here? The documentation seems ambiguous as to the meaning of that word. But anyway, we did use the same X-Id header in all of the requests.
Any pointer about what we're doing wrong would be appreciated, since we tried pretty much anything by now.
The SmartREST protocol was developed for a IoT-device <-> platform communication. So there was never any design around using it to subscribing to realtime data (except of course for the operations a device needs) as usually devices to not need subscribe to the data that they created themselves.
That said it is possible to use it but with a couple of limitations. Your approach is basically correct but there is one problem with the subscription. The wildcard subscriptions will not work with SmartREST because on subscription it links your X-Id with the channel you subscribed to but there is never a message published on the channel /alarms/*. Thus this kind of weird error message that said that there was no template subscribed for the channel the alarm appeared on. Inside CometD you still receive the alarm because of the wildcard subscription but the SmartREST part does not work.
The messages are published on the channel with the deviceId (e.g. /alarms/12345).
If you subscribe to /alarms/12345 it will work. You can of course subscribe to as many channels as you want but wildcard subscription won't work.
Regarding the templates you need to know the following. The SmartREST parsing is not done on the raw JSON of CometD but on the payload inside it (e.g. the alarm). So a template for an alarm could look like this:
11,500,,$.severity,$.id,$.type,$.severity
This would trigger only if the object has a severity and would return id, type and severity.

Merge notifications with OneSignal

Using Ionic and OneSignal.
I am developing a messaging service in my app which sends push notifications when a new message is received. Ok so far.
But, I would like to merge notifications if they exceed a certain number, to avoid spamming the user with to much notifications.
Let's say if someone answer to one of my message with 3 different messages and that my app is in background, I would like the following to happen:
receive 1 notification
receive 1 other distinct notification
display only one notification which merge the previous two + a new one
Someone know, if possible and how?
I have just implemented something similar. You can look at the following documentation link
stacked notification
I just set the android_group parameter in all of my one signal api call and send a string key on every notification message.
{
app_id = "xxxxxxxxxxxx"; // one signal app id
headings = "One Signal Title Test";
content = "The demo test message";
android_group = "demo-application";
included_segments = "Active Users"; // to send notification to all active users
}
use postman to test
There's couple of parameters that you can set to group messages.
on Android you can use android_group witch accept a string and based on docs:
Notifications with the same group will be stacked together using Android's Notification Grouping feature.
And on iOS you can use thread_id witch also accept a string:
This parameter is supported in iOS 12 and above. It allows you to group related notifications together. If two notifications have the same thread-id, they will both be added to the same group.
There are couple more parameters that might be useful that you can check on Grouping & Collapsing OneSignal Docs

What is the name of the App Launch event for Facebook Analytics?

I'm trying to implement the new analytics for a Facebook game (using HTML/Javascript and Flash on Canvas, so there is no mobile version), but it seems that the documentation is incomplete. It says that there are 14 predefined events:
"Events are one of 14 predefined events such as 'added to cart' in a
commerce app or 'level achieved' in a game"
Source: https://developers.facebook.com/docs/reference/javascript/FB.AppEvents.LogEvent
"The fourteen pre-defined events are: App Launch, Complete
Registration, Content View, Search, Rating, Tutorial Completed, Add to
Cart, Add to Wishlist, Initiated Checkout, Add Payment Info, Purchase,
Level Achieved, Achievement Unlocked, Spent Credits."
Source: https://developers.facebook.com/docs/app-events/faq
However, on the reference page where all the events should be listed, the list is only 12 items long, and there is no "App launch" event:
https://developers.facebook.com/docs/reference/javascript/FB.AppEvents.LogEvent#events
Now, there are some sample event lists for some games, but they are very basic and they don't include the actual code: https://developers.facebook.com/docs/app-events/best-practices#casual
which recommends to use these events:
App Install
App Launch
Completed Registration
Completed Tutorial
Level Achieved
Achievement Unlocked
(...)
Here is what I have so far:
FB.AppEvents.activateApp()
But is this event the equivalent of App Install or App Launch?
Also, should I send this before the user accepts to share his basic info or after? I'm having so many questions because it's not clear what activateApp() does...
Here is some code for sending some other events that could be useful:
FB.AppEvents.logEvent(FB.AppEvents.EventNames.COMPLETED_REGISTRATION);
FB.AppEvents.logEvent(FB.AppEvents.EventNames.COMPLETED_TUTORIAL);
var params = {};
params[FB.AppEvents.ParameterNames.LEVEL] = '12'; //player level
FB.AppEvents.logEvent(
FB.AppEvents.EventNames.ACHIEVED_LEVEL,
null, // numeric value for this event - in this case, none
params
);
I still have more questions: how can I properly send the game version number (maybe with activateApp?) so I can create segments and cohorts later? Some example codes would be really appreciated!
Thanks in advance!
FB.AppEvents.activateApp() provides install and launch event functionality, which is why those two events are not enumerated as options in https://developers.facebook.com/docs/reference/javascript/FB.AppEvents.LogEvent#events. Activate app doesn't take a parameter. You might want to look at using a custom event to satisfy your use case.