I want to enable SSO for Adaptive Cards Tab following the SSO pattern for message extensions.
And the type of interface TabResponsePayload includes "silentAuth".
refer to the url: https://github.com/microsoft/botbuilder-js/blob/main/libraries/botframework-schema/src/teams/index.ts#L1352
type?: "continue" | "auth" | "silentAuth"
In handleTeamsTabFetch, I return the tabResponse:
{
tab: {
type: "silentAuth",
suggestedActions: {
actions: [
{
type: "openUrl",
value: signInLink,
title: "Sign in to this app"
}
]
}
}
}
However, when I was debugging in Microsoft Teams, the error occurred:
{"errorCode":1008,"message":"Error when processing invoke response: Tab response type (silentAuth) from bot is not supported"}
Does anyone know what's going on here?
Related
After we get the user access token using Sign in with slack, we can query identity information as shown below:
{
ok: true,
user: {
name: 'arbxxxxxxx',
id: 'U0XXXXXXX',
email: 'arbxxxxxxx#xxxxxxx.com'
},
team: { id: 'T0XXXXXXX' },
response_metadata: {
scopes: [ 'identity.basic', 'identity.email', 'openid' ],
acceptedScopes: [ 'identity.basic' ]
}
}
The current workspace is team: { id: 'T0XXXXXXX' }.
How can I get all the other workspaces?
FYI: Sign in and acces token usage is shown in at this gist: https://gist.github.com/seratch/92bf98679d7a37a87dfa7376d02a51a1
With the exception of Org Apps installed on a Grid, users actually auth per workspace, and each is a unique identity, there's no real concept of a single identity that spans across workspaces
I am implementing Mastercard's Hosted Checkout Integration. Detail see below.
https://ap.gateway.mastercard.com/api/documentation/integrationGuidelines/hostedCheckout/integrationModelHostedCheckout.html
For checkout.js, I am using interaction.operation: "PURCHASE"
Checkout.configure({
merchant: <xxxx>,
order: {
amount: xxxx,
currency: "AUD",
description:<xxxxx>,
id: <my own order id, unique>,
},
session: {
id: <i can successfully get the session id>,
},
interaction: {
merchant: {
name: <xxxx>,
logo:logo_url_secure
},
operation: "PURCHASE",
displayControl: {
billingAddress: "HIDE",
},
},
});
Checkout.showLightbox();
The checkout light box can load etc. with no problem. Filled in the test card info.
The "ACS Emulator" shows up as normal. see screenshot below.
After click on "Submit" on the "ACS Emulator" page, it always gives a "Payment Unsuccessful" result with no error msg etc. See below
checked the API call to the bank,
https://xxxxxxxxxx.ap.gateway.mastercard.com/checkout/api/performPayment/SESSIONxxxxxxxxxxxxxxxxxxxxx?charset=UTF-8
the response is 200, but not successful.
{
"merchantReturnUrl":false,
"success":false,
"threeDsRequired":false,
"alreadySuccessfullyProcessed":false,
"sessionId":"SESSIONxxxxxxxxxxxxx",
"receiptUrl":"/checkout/receipt/SESSIONxxxxxxxx",
"receiptData":{
"paymentMethod":null,
"paymentDetail1":null,
"orderDate":"4/09/21 7:34 PM"
},
"transactionId":"2"
}
Anything I did wrong here?
I suspect my test account might not been setup properly?
Any hints are very much appreciated?
I have working cross-platform extension which I converted for Safari using xcrun safari-web-extension-converter PATH. Goal of extension is to bookmark any URL into my website account (https://ourdomain.in).
My extension is perfectly working fine for Chrome but for Safari version, everything works well if user allows access permission for every website.
The issue is, even though I have proper optional_permissions and used chrome.permissions.request() method to ask user-consent for ourdomain.in, and we see user allowed access, still tab.url comes blank for chrome.tabs.onUpdated every time.
Here is the case in detail, when user presses extension button, we are checking user is logged into its account or not by opening our website URL into another tab.
var openSignin = function openSignin() {
console.log('hey');
chrome.tabs.create({ url: _config.baseURL + '?extension=1', active: false });
};
When this AUTH tab is loaded, following method will be called as it happens in Chrome which in turn extracts public and private tokens generated when any user logs into our website.
chrome.tabs.onUpdated.addListener(function (tabID, changeInfo, tab) {
if (tab.status == 'complete' && tab.url.startsWith(_config.baseURL)) {
chrome.tabs.executeScript(tab.id, { code: 'localStorage.getItem("PUBLIC")' }, function (r) {
localStorage['PUBLIC'] = JSON.parse(r[0]);
chrome.tabs.executeScript(tab.id, { code: 'localStorage.getItem("PRIVATE")' }, function (r) {
localStorage['PRIVATE'] = JSON.parse(r[0]);
if (localStorage['PRIVATE'] && tab.url === _config.baseURL + '?extension=1') {
chrome.tabs.remove(tabID);
}
});
});
}
});
The issue lies here is that until user does not grant for "Always Allow on Every Website" (I mean grant permission for https://ourdomain.in/extension?extension=1), chrome.tabs.onUpdate is giving tab.url = "" and it does not give proper URL value so our conditions don't match and know that particular user is signed in or not.
Following is our manifest.json where I have event used optional_permissions:
{
"name": "EXT NAME",
"description": "DESCRIPTION",
"manifest_version": 2,
"version": "1.0.181",
"minimum_chrome_version": "23",
"offline_enabled": true,
"browser_action" : {
"default_icon" : {
"64": "logo/icon.png"
},
"default_title" : "Add here"
},
"background" : {
"scripts" : [
"background.js"
]
},
"content_scripts": [{
"js": [ "content.js" ],
"matches": [ "<all_urls>" ]
}],
"icons": {
"16": "logo/icon_small.png",
"64": "logo/icon.png"
},
"permissions" : [
"https://*.ourdomain.in/*",
"activeTab",
"gcm",
"storage",
"notifications",
"identity",
"contextMenus",
"tabs",
"idle"
],
"externally_connectable": {
"matches": ["https://*.ourdomain.in/*"]
},
"optional_permissions": ["activeTab", "tabs", "storage", "contextMenus", "*://*.ourdomain.in/*"],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"web_accessible_resources": [
"corner.css",
"js/init.js",
"content.js",
"js/jquery.min.js",
"js/taggle.min.js",
"js/typeahead.bundle.min.js",
"ext.html.js",
"assets/*"
],
"commands": {
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+S",
"mac": "Command+Shift+S"
},
"description": "Send a link to DOMAIN!"
}
}
}
And following is the code for permission request which is implemented in click event handler of extension button.
chrome.browserAction.onClicked.addListener(function (tab) {
var reqPerm = {
permissions: ["activeTab", "tabs", "storage", "contextMenus"],
origins: ['https://ourdomain.in/']
};
chrome.permissions.request(reqPerm, function (granted) {
if (granted) {
return go(tab.url);
} else {
console.log("Requested not granted.");
chrome.tabs.sendMessage(tabID, { action: 'signin', text: 'Please allow stash.ai to proceed.' });
}
});
});
Here I am able to see Privacy dialog and I do press Allow for the Day.
Now if I see in Safari > Preferences > Websites > Stash Extension, I am clearly able to see ourdomain.in -> Allowed which proves prompt worked as expected I believe.
Still when new tab is opened for authentication, the above mentioned code for chrome.tabs.onUpdate is executed and gives tab.url = ''. This definitely works when Allow for Every website is turned on.
And other thing is, when I open https://ourdomain.in, my extension icon still shows disabled and on click of the icon it again asks me for the permission. If on this tab, I do give permission, everything works smooth.
Thus, chrome.permissions.request() is no use if I have to manually give permission from tab.
Please let me know any suggestions here.
The answer was so simple, I have to change my reqPerm like,
var reqPerm = {
permissions: ["activeTab", "tabs", "storage", "contextMenus"],
origins: ['https://ourdomain.in/*']
};
So every endpoint in ourdomain.in works.
I am currently using Amazon lex to create a chatbot and want to be able to post multiple response cards at once. The question asked by the chatbot will be "Do you have an integrated Shield Plan currently?" and followed will be multiple response cards where it will show a list of plans from different brands. But if the user does not have a plan, there will be an option called "No" on the response card.
But if I publish the chatbot let's say on Slack, not even one response card is shown. How do I fix this problem?
You have not specified the Card Image URL, this is why there is no card.
I have just now tested it, without Image Card URL ResponseCard will not be shown on Facebook or Slack if we are setting it using console.
However if you are setting Response Cards in Lambda function, then we can choose not to have an image. You can check that slot is filled or not in the DialogCodeHook and display the ResponseCard accordingly.
Below is sample code to display ResponseCard without an image:
{
'dialogAction': {
'type': 'Close',
'fulfillmentState': 'Fulfilled',
'message': {
'contentType': 'PlainText',
'content': message
},
'responseCard': {
'version': '0',
'contentType': 'application/vnd.amazonaws.card.generic',
'genericAttachments': [
{
'title': 'title1',
'subTitle': 'subtitle',
"buttons":[
{
"text":"button 1",
"value":"value 1"
},
{
"text":"button 2",
"value":"value 2"
},
{
"text":"button 3",
"value":"value 3"
}
]
}
}
}
}
Hope it helps.
I'm asking user to select from multiple options as follows
var reportData = {
"Report A Traffic Violation": {
intent: 'report_a_traffic_violation'
},
"Report a Lost Property": {
intent: 'report_a_traffic_violation'
},
"Describe Incident": {
intent: '/describeIncident'
}
};
builder.Prompts.choice(session, "please select from options", reportData);
But the options shows to the user in single line. How can I show the options to the user using multiple lines as follows?
option one
option two
option three
Node.js
Based on the code you provided I suppose you are using node.js
You may have a look to the Contoso-Flowers sample provided by Microsoft, in its settings function: code here and preview with the list visible here.
Here is how they are handling the list:
var SettingChoice = {
Email: 'edit_email',
Phone: 'edit_phone',
Addresses: 'edit_addresses',
Cancel: 'cancel'
};
var lib = new builder.Library('settings');
lib.dialog('/', [
// Display options
function (session) {
builder.Prompts.choice(session, 'settings_intro', [
session.gettext(SettingChoice.Email),
session.gettext(SettingChoice.Phone),
session.gettext(SettingChoice.Addresses),
session.gettext(SettingChoice.Cancel)
]);
},
Did you try to use an array like here?
C#
For those building their bots in C#, you just have to specify your PromptStyle to PromptStyle.PerLine
For js : Although '\n' is the universal newline characters.
For c# SDK : Environment.NewLine.
Try adding the listStyle parameter:
builder.Prompts.choice(
session,
"please select from options",
reportData,
{listStyle: builder.ListStyle.list}
);
More information on list styles in Bot Framework documentation: https://learn.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-dialog-prompt