I am trying to create a function that displays a chrome notification from my app when an update is available. I typed it all up and it just doesn't work.
function updatenotification() {
chrome.notifications.create(memeNotification, {
"type": "basic",
"iconUrl":"icons/icon48.png",
"title": "Update Available!",
"message": "There is an update available for Meme Music Board!"
});
};
Here is what I have. It is supposed to be triggered by the onUpdateAvailable api. However, no matter how I try to trigger the function it does NOT make a notification. I cannot even get any notifications to display. I have added the notifications permission to the manifest. I have tried it in my background.js as well as my main javascript. I am at my wits end. Any help would be wonderful. Thank you.
Edit!
I have also tried:
var options = {
type : "basic",
title: "Update Available",
message: "An Update is available",
expandedMessage: "An Update is available for Meme Music Board",
},
function notify() {
chrome.notifications.create(options);
},
And for some reason it just does not work. This method works on other apps made by others.
Related
I am building a tool that allows users to generate their own custom form surveys. I would like to give them the ability to convert these traditional form surveys into a chat conversation. I am already using the Microsoft Bot Builder SDK to interact with users through chat.
How can I generate dialogs dynamically using the form structure that is stored in my database? Assume that I have an array like this one stored in my database:
var form = [
{
inputType: 'text',
prompt: 'What is your first name?'
},
{
inputType: 'choice',
prompt: 'Select your gender',
values: ['female', 'male']
}
];
How can I generate a waterfall dialog using this array? I know I can just manually write the dialog code using prompts etc. if I know what the survey questions are all the time but I have to generate the dialog based on a dynamic form that users save. I can't find any information about how to achieve this. Appreciate the help. Thanks.
You can accomplish this using a community contributed tool called "Form Flow" - it is designed to accomplish a similar idea to yours.
You can find the NPM package here:
https://www.npmjs.com/package/botbuilder-formflow
More details available on the GitHub project repository here:
https://github.com/gudwin/botbuilder-formflow
Overview:
This Library will allow your bot to request complex forms from a user. It helps to build a waterfall dialog that will handle the whole form flow. The library will split into a list of dialogs required for each field. You can use predefined prompts or create you custom dialog wrappers around MBF prompts. Dialogs for each field evaluated separately and could be customized. The Library features:
Standard Prompts plus prompts for emails and urls;
Validators, Prompts, Error Prompts and Value extractors could be customized by a developer
Subdialogs are supported
Example: Simple registration form:
const builder = require('botbuilder');
const formFlow = require('../../botbuilder-formflow');
let signupForm = [
{
"type": "text",
"id": "login",
"prompt": "Please enter your login",
"response": "Your login is %s"
},
{
"type": "text",
"id": "password",
"prompt": "Please enter your password",
"response": "Your password is %s"
}
];
let connector = new builder.ConsoleConnector().listen();
let bot = new builder.UniversalBot(connector);
bot.dialog('/', [
session => session.beginDialog('/form'),
(session, response) => session.endDialog(`Form result: ${JSON.stringify(response.response)}`)
]);
formFlow.create(bot, '/form', signupForm);
console.log('To start registration flow press [[ENTER]]');
Alternatively, besides leveraging the npm package as #nilsw mentioned, you can try to build up an Adaptive Card json string by yourself from the entities in your database.
The field definition code snippet is simple:
{
"type": "TextBlock",
"text": "Your name",
"wrap": true
},
{
"type": "Input.Text",
"id": "myName",
"placeholder": "Last, First"
},
You can refer http://adaptivecards.io/samples/InputForm.html for the input form sample.
And also, refer to http://adaptivecards.io/explorer/Input.Choice.html for the fields definitions.
Good day to everyone.
I have a problem with AWS cognito user pools custom message which is created inside lambda function as a trigger (custom message lambda). Message with verification link inside. In particular I'm setting message subject to "Custom subject" (and email has this subject), and message body to "Use this {##Custom link##} instead" (and the message is not appear in the body, but the one from user pools web interface is used).
My code is:
public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
JsonNode json = parseJsonFromStream(input);
ObjectNode jsonWithResponse = (ObjectNode) json;
jsonWithResponse.with("response").put("emailMessage", "Use this {##Custom link##} instead");
jsonWithResponse.with("response").put("emailSubject", "Custom subject");
try (Writer w = new OutputStreamWriter(output, "UTF-8")) {
w.write(jsonWithResponse.toString());
}
}
I had tried to set even {####} instead {##Link text##} and still same. I'm almost sure it worked some time ago (and I don't remember I changed anything). Does anyone has any idea where should I take a look (dig). As I spent too much time on that and neither missing something (hopefully) small or they have some changes/issues.
P.S. lambda test success. Lambda output looks fine (I eliminate logger here).
Upd: (logger output with response)
OUTPUT JSON is
{
"version": "1",
"region": "eu-west-1",
"userPoolId": "****",
"userName": "*****",
"callerContext": {
"awsSdkVersion": "aws-sdk-android-2.6.7",
"clientId": "****"
},
"triggerSource": "CustomMessage_SignUp",
"request": {
"userAttributes": {
"sub": "****",
"email_verified": "false",
"cognito:user_status": "UNCONFIRMED",
"nickname": "Yaroslav",
"email": "****"
},
"codeParameter": "{####}",
"usernameParameter": null
},
"response": {
"emailMessage": "Use this {##Custom link##} instead",
"emailSubject": "Custom subject"
}
}
Upd2 (JS trigger):
I added code on js (new trigger for custom email) based on example and that works for custom email when user wants confirmation code, but that doesn't work for confirmation link. Again, I tried {##link##} for the link.
So what I ended up with is to use code confirmation. In this case custom email works as expected.
To prevent the user from typing the password into the app, I sent email with custom link, which include the code parametr. Custom link pointed to API Gateway which had corresponding lambda to handle everything and finish the user registration.
I have a problem with Azure AD Graph API integration where we try to create user to existing Active directory. Used azure documentation to work on this (https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/users-operations#UpdateUser)
For some reason the example dataset is not working, but I'm receiving:
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "One or more property values specified are invalid."
},
"values": null
}
}
The dataset I'm passing is
{
"accountEnabled": true,
"displayName": "Test User",
"mailNickname": "TestUser",
"passwordProfile": {
"password": "Test1234",
"forceChangePasswordNextLogin": false
},
"userPrincipalName": "Test#_MY_DOMAIN_.onmicrosoft.com"
}
_MY_DOMAIN_ is one of the domains defined in the Active directory's domains.
If I try e.g. removing any of the required fields, I'm receiving error which defines the missing property.
Listing and updating users is working just fine, there is some weird issue with adding.
Usually, we will get this issue when we haven't set the Url in the correct format. I tested your dataset on my side, it worked fine. Please double check the url.
Here is the capture of my test request:
Any further concern, please feel free to let me know.
Most probably problem was related to Azure AD permissions. Somehow started suddenly working.
One thing figured out is that the error message above will also come e.g. if you have property key mistyped. Sometimes response describes the missing property, but not always.
Thanks everyone for your time..
I'm working right now on uploading youtube videos from a web client to Youtube.
I want to use Javascript to upload video and show the uploaded video before post the url uploaded to my server database.
So the first thing i did is to create an account in Youtube console. and activating Youtube Data Api and then i created an ID clients OAuth 2.0 with the type : Web application and id client has this form : 000000-x1x1x1.apps.googleusercontent.com i have also add an authorized referrer : http://127.0.0.1:3300 since i work in localhost.
So it seems that all is well configured, I've followed the official tutorial youtube gives but when i try to upload a video i had this error :
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid value for: is not a valid value"
}
],
"code": 400,
"message": "Invalid value for: is not a valid value"
}
}
Does any one had this error?
Thanks
I figured it out why i couldn't upload a video the tutorial Youtube gives is not complete Youtube Javascript upload, there is some parameters that i must send and the params i needed are title, description and finally and the most wanted privacyStatus, what i did is adding two text fields with ids #description and #title and fill those text fields with correct data And at last fill the privacyStatus with (private|public) this mean how you want your video to be uploaded.
You can update the upload js file given by Youtube like so :
var metadata = {
snippet: {
title: $('#title').val(),
description: $('#description').text(),
tags: this.tags,
categoryId: this.categoryId
},
status: {
privacyStatus: "public"
}
};
Is there any way to get the reads of a user in washington post or yahoo reader?
I have checked http://developers.facebook.com/docs/reference/api/ where one gets access to news feed and profile feed, but they dont gives what the user has read in washington post / yahoo reader. Is there any way to get this information using javascript jdk?
What I have tried:
After login in thorugh the login in button. I query
FB.api('/me/washington_posts', function(response) {
var wash_post=JSON.stringify(response);
alert(wash_post);
});
graph.facebook.com/me/317071798339058?access_token=AAAAAAITEghM...
graph.facebook.com/me/...
I tried sevaral combinations of washington_posts, but always got error. I know this was not going to work but tried for some luck There is no documentaion of the same as mentioned here.
I believe its not possible to get it as of now as wpsocialreader is a diiferent fb app. apps.facebook.com/wpsocialreader/… I am only able to get the app info.
graph.facebook.com/267401179951379 :
{ "id": "267401179951379", "name": "Washington Post Social Reader", "link": "facebook.com/wpsocialreader";, "likes": 169544, "category": "App", "is_published": true, "website": "washingtonpost.com/socialreader";, "username": "wpsocialreader", "description": ".........", "about": "News. Better with friends. ", "release_date": "2011", "can_post": true, "talking_about_count": 19977 }
I think it is not possible to collect data from washington post reader app, so I am looking if somebody have already done it.
You can get the entries with the open graph action type news.read from yourself or a friend using the graph API:
graph.facebook.com/me/news.reads or graph.facebook.com/USER_ID/news.reads
Obviously, add in the access token and other graph parameters you need as well. This will return all reads from the applications that publish them. You could then pick out the social reader reads by app id.
Hope this helps.
-matt