How to define a custom function in deluge? - zoho

I want to create an automated email in Zoho Cliq that sends a message to everyone every morning. In the message there is a button that should call the sendMsg function.
How can I define the sendMsg function?
The idea is that by pressing the button another message should be sent back to me.
Thanks for the help
response = map();
response.put("text","Wie startest du heute in deinen Tag?");
card = map();
card.put("title","Guten Morgen ☕");
response.put("card",card);
buttonsList = list();
buttonsList0 = map();
buttonsList0.put("label","Remote");
buttonsList0.put("type","+");
action = map();
action.put("type","invoke.function");
data = map();
data.put("name","sendMsg");
action.put("data",data);
buttonsList0.put("action",action);
buttonsList.add(buttonsList0);
response.put("buttons",buttonsList);

Well, to define a custom function, you need to start with the "function" keyword, followed by the name of the function and its parameters enclosed in parentheses.
For example:
function my_function(input1, input2) {
}

Related

Want to make a button that controls a function in zoho

I want to create an automated email in Zoho Cliq that sends a message to everyone every morning. In the message there is a button that should call the sendMsg function.
How can I define the sendMsg function?
The idea is that by pressing the button another message should be sent back to me.
Thanks for the help
response = map();
response.put("text","Wie startest du heute in deinen Tag?");
card = map();
card.put("title","Guten Morgen ☕");
response.put("card",card);
buttonsList = list();
buttonsList0 = map();
buttonsList0.put("label","Remote");
buttonsList0.put("type","+");
action = map();
action.put("type","invoke.function");
data = map();
data.put("name","sendMsg");
action.put("data",data);
buttonsList0.put("action",action);
buttonsList.add(buttonsList0);
response.put("buttons",buttonsList);

How the bot's cards containg qnaid and context behave like QnA test?

In the test in QnA portal like the below screenshot, those buttons are created by the follow-up prompts from QnA, and when click those buttons, the next Http request contains all the prompts information like text and qnaid. Those the next response will be the answer of the specific qnaid.
But in the Bot -qnamaker-prompting Sampleenter link description here, when click the button, the Http request just contain the text as questions, thus the QnA will not get the answer bind with the qnaid. The answer may will not bind with qnaid and just context.
enter image description here
So anyone have ideas on how to create a bot like QnA test?
Generally, this is how you can get the same returned results generated from the getAnswers() API call as you get from QnA.
First, pass the current context into getAnswers() (which contains the user's message: "help", "Where did trees come from", "Why is the sky blue?", etc.) and then map the result to a variable:
const stepResults = turnContext.context;
let qnaResults = await this.qnaMaker.getAnswers(stepResults);
After validating a response is returned, you can pass the result text into an activity:
await innerDc.prompt('ConfirmPrompt', qnaResults[0].context.prompts[0].displayText);
Logging the above qnaResults[0].context.prompts shows the returned prompt values align with request payload seen in devtools:
With regards to the sample you linked, the prompt value is the returned QnAPrompts[] results (i.e. the follow-up prompt). If a prompt is present in the overall QnA results, it is parsed and displayed as a button. The displayText is coming from that prompt.
public static Activity GetHeroCard(string cardTitle, QnAPrompts[] prompts)
{
var chatActivity = Activity.CreateMessageActivity();
var buttons = new List<CardAction>();
var sortedPrompts = prompts.OrderBy(r => r.DisplayOrder);
foreach (var prompt in sortedPrompts)
{
buttons.Add(
new CardAction()
{
Value = prompt.DisplayText,
Type = ActionTypes.ImBack,
Title = prompt.DisplayText,
});
}
var plCard = new HeroCard()
{
Title = cardTitle,
Subtitle = string.Empty,
Buttons = buttons
};
var attachment = plCard.ToAttachment();
chatActivity.Attachments.Add(attachment);
return (Activity)chatActivity;
}
Hope of help!

Is it possible to launch native apps using Microsoft bot framework?

I am creating a Cortana skill on the Cortana canvas, I have a button.
I wanted to know if it possible to have an 'imback' type of button to open a webpage.
Ye, for example
var message = context.MakeMessage() as IMessageActivity;
message.ChannelData = JObject.FromObject(new
{
action = new { type = "LaunchUri", uri = "skype:echo123?call" }
});
await context.PostAsync(message);
this code will start a call with echo123 user on skype
Reference: https://learn.microsoft.com/en-us/cortana/tutorials/bot-skills/bot-entity-channel-data
You can supply an openUrl to a card action, or even use ChannelData to send a LaunchUri command, deep linking to an application. (I haven't tried this, but I assume 'http://websitename.com' will launch in the Cortana host platform's default browser.)
activity.ChannelData = new {
action = new { type = "LaunchUri", uri = "http://websitename.com"}
};

Google apps script UI how to insert message into VerticalPanel()?

I'm trying to write this simple UI which should show a message with two parameters (name, email2send). But, when I run it, I get only this:
The content of the variable msg is not shown in the pannel, only the pannel title. What is the right way to do this?
// Show confirmation
function showMSG(name, email2Send) { // for ease of use I give the urls as parameters but you could define these urls in the function as well
var app = UiApp.createApplication().setHeight(60).setWidth(200);
app.setTitle("Msg send with sucess!");
var msg = "You request to " + email2Send + " a response from " + name;
app.add(app.createVerticalPanel().setTag(msg));
var doc = SpreadsheetApp.getActive();
doc.show(app);
}
THANKS in advance for any help!
The TAG of a widget is not visible, its purpose is actually to store string data in a way that is not visible.
To show a text use a label or an html widget.
example in your code :
function showMSG(name, email2Send) { // for ease of use I give the urls as parameters but you could define these urls in the function as well
var app = UiApp.createApplication().setHeight(60).setWidth(200);
app.setTitle("Msg send with sucess!");
var msg = "You request to " + email2Send + " a response from " + name;
app.add(app.createVerticalPanel().add(app.createLabel(msg)));
var doc = SpreadsheetApp.getActive();
doc.show(app);
}

Xamarin Social post without interface prompt - ShareItemAsync

I'm trying to post directly to facebook/twitter without prompting the user with a UIViewController using the following code:
// 1. Create the service
var facebook = new FacebookService {
ClientId = "<App ID from developers.facebook.com/apps>",
RedirectUrl = new System.Uri ("<Redirect URL from developers.facebook.com/apps>")
};
// 2. Create an item to share
var item = new Item { Text = "Xamarin.Social is the bomb.com." };
item.Links.Add (new Uri ("http://github.com/xamarin/xamarin.social"));
// 3. Present the UI on iOS
var shareController = facebook.GetShareUI (item, result => {
// result lets you know if the user shared the item or canceled
DismissViewController (true, null);
});
PresentViewController (shareController, true, null);
BUT the Xamarin.Social instructions say:
As an alternative to presenting the share UI, you can share items directly using the **ShareItemAsync** method of the service.
https://github.com/xamarin/Xamarin.Social
I can't find any examples or explicit tutorials on how to use this. Can anyone help me on this please?
If you look at the source of Xamarin.Social, internally ShareItemAsync is used anyways to carry out the requests. GetShareUI is just a wrapper around ShareItemAsync.
From the source of ShareViewController (which gets the UI), you can see how they are using ShareItemAsync to carry out the requests. Here's the snippet for you.
try {
service.ShareItemAsync (item, account).ContinueWith (shareTask => {
StopSharing ();
.
.
.
.
.
}, TaskScheduler.FromCurrentSynchronizationContext ());
}
So all you need to do is create the item, get hold of the account and call the method on the service, something like this
var item = new Item { Text = "Xamarin.Social is the bomb.com." };
item.Links.Add (new Uri ("http://github.com/xamarin/xamarin.social"));
var account = facebook.GetAccountsAsync().FirstOrDefault();
facebook.ShareItemAsync(item, account);

Resources