Received an invalid_authentication error when querying a Foursquare venue - foursquare

I am trying to query for details of venues using the Foursquare venues
API, but i received a "invalid_auth" error
VENUE_ID='54ea41ad498e9a11e9e13308'
VERSION = '20190823'
venueurl = 'https://api.foursquare.com/v2/venues/{}&client_id={}&client_secret={}&v={}'.format(VENUE_ID, CLIENT_ID, CLIENT_SECRET, VERSION)
venueresults = requests.get(venueurl).json()
venueresults
This is the error i received.
{'meta': {'code': 400, 'errorType': 'invalid_auth', 'errorDetail':
'Missing access credentials. See
https://developer.foursquare.com/docs/api/configuration/authentication
for details.', 'requestId': '5d613b698afbe000358acf53'},
'response': {}}
I expect to receive a response as shown below (shortened as the
response is too long.
https://foursquare.com/developers/explore#req=venues%2F54ea41ad498e9a11e9e13308
{ "meta": { "code": 200 "requestId": "5d613941075a420023f41750" }
"notifications": [ { "type": "notificationTray" "item": {
"unreadCount": 0 } } ] "response": { "venue": { "id":
"54ea41ad498e9a11e9e13308" "name": "Roselle Desserts" "contact": {
"phone": "+14163688188" "formattedPhone": "+1 416-368-8188" "twitter":
"roselle_to" } "location": { "address": "362 King St E" "crossStreet":
"Trinity St" "lat": 43.653446723052674 "lng": -79.3620167174383
"labeledLatLngs": [ { "label": "display" "lat": 43.653446723052674
"lng": -79.3620167174383 } ] "postalCode": "M5A 1K9" "cc": "CA"
"city": "Toronto" "state": "ON" "country": "Canada"
"formattedAddress": [ "362 King St E (Trinity St)" "Toronto ON M5A
1K9" "Canada" ] } "canonicalUrl":
"https://foursquare.com/v/roselle-desserts/54ea41ad498e9a11e9e13308"
"categories": [ { "id": "4bf58dd8d48988d16a941735" "name": "Bakery"
"pluralName": "Bakeries" "shortName": "Bakery" "icon": { "prefix":
"https://ss3.4sqi.net/img/categories_v2/food/bakery_" "suffix": ".png"
} "primary": true } { "id": "4bf58dd8d48988d1d0941735" "name":
"Dessert Shop" "pluralName": "Dessert Shops" "shortName": "Desserts"
"icon": { "prefix":
"https://ss3.4sqi.net/img/categories_v2/food/dessert_" "suffix":
".png" } } { "id": "4bf58dd8d48988d1c9941735" "name": "Ice Cream Shop"
"pluralName": "Ice Cream Shops" "shortName": "Ice Cream" "icon": {
"prefix": "https://ss3.4sqi.net/img/categories_v2/food/icecream_"
"suffix": ".png" } } ] "verified": false "stats": { "tipCount": 15
"usersCount": 674 "checkinsCount": 561 "visitsCount": 1203 } "url":
"http://www.roselleto.com" "price": { "tier": 1 "message": "Cheap"
"currency": "$" } "likes": { "count": 45 "groups": [ { "type":
"others" "count": 45 "items": [ ] } ] "summary": "45 Likes" } "like":
false "dislike": false "ok": false "rating": 8.8 "ratingColor":
"73CF42" "ratingSignals": 54 "allowMenuUrlEdit": true "beenHere": {
"count": 0 "unconfirmedCount": 0 "marked": false
"lastCheckinExpiredAt": 0 } "specials": { "count": 0 "items": [ ] }
"photos": { "count": 39 "groups": [ { "type": "checkin" "name":
"Friends' check-in photos" "count": 0 "items": [ ] } { "type": "venue"
"name": "Venue photos" "count": 39 "items": [ "0": { "id":
"5d59a14744209c00089c596b" "createdAt": 1566155079 "source": { "name":
"Swarm for iOS" "url": "https://www.swarmapp.com"
etc

I have found the answer, a "?" instead of "&" is required after the venue_id
'https://api.foursquare.com/v2/venues/{}?client_id={}&client_secret={}&v={}'.format(VENUE_ID, CLIENT_ID, CLIENT_SECRET, VERSION)
Refer to the Q&A below:
Authentication error in nested API request

Related

Typescript to update Mongodb

Got thrown into a Typescript/Mongodb project and am having some trouble getting started. I've been asked to convert data from
{
"_id": {
"$oid": "636c0a8dce0eb36dc13e63b3"
},
"status": "active",
"companies": [
{
"$oid": "5f64bd6785fad3e83771bb4f"
}
],
"whitelists": [],
"taxonomies": [
{
"$oid": "6080538565c2036dbeadcdfa"
},
{
"$oid": "6080538765c2036dbeadce07"
},
{
"$oid": "6080538d65c2036dbeadce44"
},
{
"$oid": "6080538d65c2036dbeadce46"
}
],
"itemType": "unit",
"attributes": [
{
"_id": {
"$oid": "6384d2bdf29f40634fe77db4"
},
"type": "ingredients:statement",
"key": "0",
"parent": "nutrition:panel#0",
"uid": "ingredients:statement#0",
"value": {
"footnotes": [],
"statement": "ingredients: water, butter, lemon juice, wheat flour, egg yolks, sea salt, xanthan gum, turmeric, carotenes."
}
},
{
"_id": {
"$oid": "6384d2bdf29f40634fe77db5"
},
"type": "allergens",
"key": "0",
"parent": "nutrition:panel#0",
"uid": "allergens#0",
"value": {
"type": "contains",
"statement": "contains something"
}
},
{
"_id": {
"$oid": "6384d2bdf29f40634fe77db5"
},
"type": "allergens",
"key": "0",
"parent": "nutrition:panel#0",
"uid": "allergens#0",
"value": {
"type": "something",
"statement": "may contain something"
}
},
{
"_id": {
"$oid": "6384d2bdf29f40634fe77db6"
},
"type": "variants:flavors:raw",
"key": "0",
"parent": "nutrition:panel#0",
"uid": "variants:flavors:raw#0",
"value": [
"hollandaise sauce"
]
}
],
"dataUpdatedDate": {
"$date": {
"$numberLong": "1668025007811"
}
}
}
To something like this, merging objects with the same "type" "b"
{
"_id": {
"$oid": "636c0a8dce0eb36dc13e63b3"
},
"status": "active",
"companies": [
{
"$oid": "5f64bd6785fad3e83771bb4f"
}
],
"whitelists": [],
"taxonomies": [
{
"$oid": "6080538565c2036dbeadcdfa"
},
{
"$oid": "6080538765c2036dbeadce07"
},
{
"$oid": "6080538d65c2036dbeadce44"
},
{
"$oid": "6080538d65c2036dbeadce46"
}
],
"itemType": "unit",
"attributes": [
{
"_id": {
"$oid": "6384d2bdf29f40634fe77db4"
},
"type": "ingredients:statement",
"key": "0",
"parent": "nutrition:panel#0",
"uid": "ingredients:statement#0",
"value": {
"footnotes": [],
"statement": "ingredients: water, butter, lemon juice, wheat flour, egg yolks, sea salt, xanthan gum, turmeric, carotenes."
}
},
{
"_id": {
"$oid": "6384d2bdf29f40634fe77db5"
},
"type": "allergens",
"key": "0",
"parent": "nutrition:panel#0",
"uid": "allergens#0",
"value": [{
"type": "contains",
"statement": "contains something"
},
{
"type": "something",
"statement": "may contain something"
}
]},
{
"_id": {
"$oid": "6384d2bdf29f40634fe77db6"
},
"type": "variants:flavors:raw",
"key": "0",
"parent": "nutrition:panel#0",
"uid": "variants:flavors:raw#0",
"value": [
"hollandaise sauce"
]
}
],
"dataUpdatedDate": {
"$date": {
"$numberLong": "1668025007811"
}
}
}
My background is php/mysql. I understand the basics here just can't put it together. Any help would be greatly appreciated.
Thanks
I have the basics of the typescript started to grab all the appropriate documents. I don't know how to go about combining some of the data and updating it back to mongo
Here is the basic code I am starting with
makeScript({
module,
db: true,
init: async _argv => {
await Pv2.find({
attributes: {
$elemMatch: {
type: 'allergens'
},
},
})
.limit(10)
.cursor()
.eachAsync(async (oldPv2s: Pv2Doc | Pv2Doc[]) => {
// not sure what goes here
});
}
});

How do I send customer data from twilio to stripe?

I'm using Twilio to allow my customers to pay automatically over the phone via to stripe. I followed this tutorial: Is there a way to enter dollars/cents via DTMF?
The issue I'm running into is how do I send the "phone number" as a "customer" into stripe? The reason I want this is to be able to see who bought what and how many times etc. Currently, they are all coming into stripe as unknown/guest.
My only success has been (I'm using the studio) entering {{trigger.call.From}} into the "payment description". That still doesn't solve the issue fully though.
Any help would be greatly appreciated!
Here is my flow code:
{
"description": "A New Flow",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{
"next": "received_message_forward",
"event": "incomingMessage"
},
{
"next": "gather_1",
"event": "incomingCall"
},
{
"event": "incomingConversationMessage"
},
{
"event": "incomingRequest"
},
{
"event": "incomingParent"
}
],
"properties": {
"offset": {
"x": 0,
"y": 0
}
}
},
{
"name": "gather_1",
"type": "gather-input-on-call",
"transitions": [
{
"next": "function_1",
"event": "keypress"
},
{
"event": "speech"
},
{
"next": "gather_1",
"event": "timeout"
}
],
"properties": {
"voice": "man",
"speech_timeout": "auto",
"offset": {
"x": 30,
"y": 270
},
"loop": 1,
"finish_on_key": "#",
"say": "Welcome and thank you for calling the donation line. Please enter the amount you wish to donate, then press pound. To enter with cents use the star key. for example to enter $18.50, press one eight star five zero.",
"language": "en-US",
"stop_gather": true,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 5
}
},
{
"name": "function_1",
"type": "run-function",
"transitions": [
{
"next": "confirm_donation_amount",
"event": "success"
},
{
"event": "fail"
}
],
"properties": {
"offset": {
"x": -60,
"y": 530
},
"parameters": [
{
"value": "{{widgets.gather_1.Digits}}",
"key": "amount"
}
],
"url": "https://sand-pointer-5043.twil.io/pay_from_exchange"
}
},
{
"name": "say_play_2",
"type": "say-play",
"transitions": [
{
"event": "audioComplete"
}
],
"properties": {
"voice": "man",
"offset": {
"x": -60,
"y": 840
},
"loop": 1,
"say": "You entered ${{widgets.function_1.body}}",
"language": "en-US"
}
},
{
"name": "pay_1",
"type": "capture-payments",
"transitions": [
{
"next": "say_play_3",
"event": "success"
},
{
"next": "say_play_4",
"event": "maxFailedAttempts"
},
{
"next": "say_play_4",
"event": "providerError"
},
{
"next": "say_play_4",
"event": "payInterrupted"
},
{
"next": "say_play_4",
"event": "hangup"
},
{
"next": "say_play_4",
"event": "validationError"
}
],
"properties": {
"security_code": true,
"offset": {
"x": -70,
"y": 1140
},
"max_attempts": 2,
"payment_connector": "",
"payment_amount": "{{widgets.function_1.body}}",
"description": "{{trigger.call.From}} via Twilio",
"currency": "usd",
"language": "en-US",
"postal_code": "false",
"payment_token_type": "reusable",
"timeout": 5,
"valid_card_types": [
"visa",
"master-card",
"amex",
"discover"
]
}
},
{
"name": "say_play_3",
"type": "say-play",
"transitions": [
{
"next": "send_success_message_1",
"event": "audioComplete"
}
],
"properties": {
"voice": "man",
"offset": {
"x": -185,
"y": 1433
},
"loop": 1,
"say": "Your donation of ${{widgets.function_1.body}} was successful, Thank you.",
"language": "en-US"
}
},
{
"name": "say_play_4",
"type": "say-play",
"transitions": [
{
"next": "send_fail_message_1",
"event": "audioComplete"
}
],
"properties": {
"voice": "man",
"offset": {
"x": 190,
"y": 1456
},
"loop": 1,
"say": "There was an error with your donation. Please verify your details and call back to try again. Thanks!",
"language": "en-US"
}
},
{
"name": "send_success_message_1",
"type": "send-message",
"transitions": [
{
"event": "sent"
},
{
"event": "failed"
}
],
"properties": {
"offset": {
"x": -100,
"y": 1700
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": "{{flow.channel.address}}",
"to": "{{contact.channel.address}}",
"body": "Your donation of ${{widgets.function_1.body}} was successful, Thank you!."
}
},
{
"name": "send_fail_message_1",
"type": "send-message",
"transitions": [
{
"event": "sent"
},
{
"event": "failed"
}
],
"properties": {
"offset": {
"x": 250,
"y": 1700
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": "{{flow.channel.address}}",
"to": "{{contact.channel.address}}",
"body": "There was an error with your donation. Please verify your details and call back to try again. Thanks!"
}
},
{
"name": "confirm_donation_amount",
"type": "gather-input-on-call",
"transitions": [
{
"next": "split_2",
"event": "keypress"
},
{
"event": "speech"
},
{
"next": "confirm_donation_amount",
"event": "timeout"
}
],
"properties": {
"number_of_digits": 1,
"speech_timeout": "auto",
"offset": {
"x": 420,
"y": 530
},
"loop": 1,
"finish_on_key": "#",
"say": "You entered ${{widgets.function_1.body}}. Press 1 to confirm, or press 2 to enter a different amount.",
"stop_gather": true,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 5
}
},
{
"name": "split_2",
"type": "split-based-on",
"transitions": [
{
"next": "confirm_donation_amount",
"event": "noMatch"
},
{
"next": "pay_1",
"event": "match",
"conditions": [
{
"friendly_name": "If value equal_to 1",
"arguments": [
"{{widgets.confirm_donation_amount.Digits}}"
],
"type": "equal_to",
"value": "1"
}
]
},
{
"next": "gather_1",
"event": "match",
"conditions": [
{
"friendly_name": "If value equal_to 2",
"arguments": [
"{{widgets.confirm_donation_amount.Digits}}"
],
"type": "equal_to",
"value": "2"
}
]
}
],
"properties": {
"input": "{{widgets.confirm_donation_amount.Digits}}",
"offset": {
"x": 430,
"y": 800
}
}
},
{
"name": "received_message_forward",
"type": "send-message",
"transitions": [
{
"event": "sent"
},
{
"event": "failed"
}
],
"properties": {
"offset": {
"x": -300,
"y": 250
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": "{{flow.channel.address}}",
"to": "{{contact.channel.address}}",
"body": "Thanks for texting the Donation line. To donate, please call us on this same number. We do not accept donations via text."
}
}
],
"initial_state": "Trigger",
"flags": {
"allow_concurrent_calls": true
}
}
Here is the function:
exports.handler = function(context, event, callback) {
const amount = event.amount;
const convert = amount.replace('*', '.');
callback(null, convert);
};

How to filter the response from mongoDB, so nested arrays will include only items that meet a condition?

My documents look like this
{
"_id": {
"$oid": "62825f71005ce00c5f0235c1"
},
"user": "jon",
"roles": {
"User": 2001,
},
"STOCK ": [
{
"sku": "BLACK-M",
"productname": "BLACK",
"sendout": 0,
"recived": 1,
"totalinstock": 40,
"location": "B32",
"_id": {
"$oid": "62826016005ce00c5f0235c8"
}
},
{
"sku": "CJNS",
"productname": "89796363",
"sendout": 0,
"recived": 45,
"totalinstock": 0,
"location": "B232",
"_id": {
"$oid": "62836f2d56b4f1ac79c99b8d"
}
}
],
"ORDERS": [
{
"date": {
"$date": "2022-06-02T15:23:58Z"
},
"OrderNumber": "745607",
"City": "xxxxx",
"Address": "yyyyyy",
"Phone": "8678678678",
"Name": "Holly ",
"Trackingnumber": 40,
"ZipCode": 00000,
"Province": "New ",
"Quantity": [
1
],
"Product_Name": [
" pants pants"
],
"SKU": [
"CJNS"
],
"_id": {
"$oid": "6298d61ba6eeec72b78332a7"
}
},
{
"date": {
"$date": "2022-06-02T15:23:58Z"
},
"OrderNumber": "748840",
"City": "xxxxx",
"Address": "yyyyyy",
"Phone": "354353454",
"Name": "Michael",
"Trackingnumber": 0,
"ZipCode": 00000,
"Province": "North",
"Quantity": [
1
],
"Product_Name": [
" pants pants"
],
"SKU": [
"CJNS"
],
"_id": {
"$oid": "6298d61ba6eeec72b78332a9"
}
}
]
}
I successful to return all the objects in STOCK or all the objects in ORDERS
Through this query
const foundUser= await User.find({"user":req.body.user},("Orders") ).exec()
Now I want to filter the response to include only items where "Trackingnumber" is different from 0
For the sample data I expect to receive only
{
"date": {
"$date": "2022-06-02T15:23:58Z"
},
"OrderNumber": "748840",
"City": "xxxxx",
"Address": "yyyyyy",
"Phone": "354353454",
"Name": "Michael",
"Trackingnumber": 0,
"ZipCode": 00000,
"Province": "North",
"Quantity": [
1
],
"Product_Name": [
" pants pants"
],
"SKU": [
"CJNS"
],
"_id": {
"$oid": "6298d61ba6eeec72b78332a9"
}
}
You can use an aggregation pipeline with a $filter for this:
db.collection.aggregate([
{
$match: {
"user": "jon"
}
},
{
$project: {
ORDERS: {
$filter: {
input: "$ORDERS",
as: "item",
cond: {$ne: ["$$item.Trackingnumber", 0]}
}
}
}
}
])
Playground example
User.find({"Orders" : {"Trackingnumber": 0} })

Shopware6 API integrity constraints on nested entities

Tested on Shopware 6.3.5.1:
I'm trying to create a product via API together with its parent. That is necessary, because I can only iterate over variants in the other system.
As far as I can tell there's no conflict with the IDs or duplicates. Neither the product nor its parent already exist.
But when I do this:
POST https://somedomain.de/api/v3/_action/sync
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
{
"7508d64f832fb06b8f82f78963b280ab": {
"action": "upsert",
"entity": "product",
"payload": [
{
"id": "7508d64f832fb06b8f82f78963b280ab",
"__code": "1111111189",
"stock": 99,
"taxId": "d390c2f211144543845dbf76fa69d17a",
"cmsPageId": null,
"deliveryTimeId": null,
"manufacturerId": null,
"visibilities": [
{
"id": "e24f994426246015347bba784ac69a97",
"productId": "7508d64f832fb06b8f82f78963b280ab",
"salesChannelId": "8e7c11e2540b4c71b521d5a59920e142",
"visibility": 30
}
],
"unitId": null,
"price": [
{
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"net": 25,
"gross": 29.75,
"linked": true
}
],
"productNumber": "1111111189",
"coverId": null,
"translations": {
"ce1df85b5f1c4eedbc532cbd34c57df6": {
"name": "Converse black",
"description": "Converse black"
},
"2fbb5fe2e29a4d70aa5854ce7ce3e20b": {
"name": "Converse black",
"description": "Converse black"
}
},
"categories": [
{
"id": "e90cf50735a0d6f69b2dbf599caa4954"
},
{
"id": "a5b4753f41c8f4bedba1bf5954c961cb"
}
],
"properties": [
{
"id": "a01a0380ca3c61428c26a231f0e49a09"
}
],
"media": [
{
"id": "cb9a886400616c215a588b13cb7c662b",
"mediaId": "a7aabb5ff4dc3c99ba45724ec7477ffe"
}
],
"parent": {
"id": "7a788255eab96bf51002829b3a6becf2",
"__code": "1111111189",
"stock": 99,
"taxId": "d390c2f211144543845dbf76fa69d17a",
"cmsPageId": null,
"deliveryTimeId": null,
"manufacturerId": null,
"visibilities": [
{
"id": "8d5a7e2b2c02986a924eaf3d9504413c",
"productId": "7a788255eab96bf51002829b3a6becf2",
"salesChannelId": "8e7c11e2540b4c71b521d5a59920e142",
"visibility": 30
}
],
"unitId": null,
"price": [
{
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"net": 25,
"gross": 29.75,
"linked": true
}
],
"productNumber": "converseblack",
"coverId": null,
"translations": {
"ce1df85b5f1c4eedbc532cbd34c57df6": {
"name": "Converse black",
"description": "Converse black"
},
"2fbb5fe2e29a4d70aa5854ce7ce3e20b": {
"name": "Converse black",
"description": "Converse black"
}
},
"categories": [
{
"id": "e90cf50735a0d6f69b2dbf599caa4954"
},
{
"id": "a5b4753f41c8f4bedba1bf5954c961cb"
}
],
"properties": [
{
"id": "a01a0380ca3c61428c26a231f0e49a09"
}
],
"media": [
{
"id": "cb9a886400616c215a588b13cb7c662b",
"mediaId": "a7aabb5ff4dc3c99ba45724ec7477ffe"
}
],
"configuratorSettings": [
{
"optionId": "a01a0380ca3c61428c26a231f0e49a09",
"id": "db3787abb8d6372e1997c144031ef1e2"
}
]
},
"parentId": "7a788255eab96bf51002829b3a6becf2",
"options": [
{
"id": "a01a0380ca3c61428c26a231f0e49a09"
}
]
}
]
}
}
I get as a response that the integrity constraint productId X saleschannelId in visibilities gets violated:
{
"success": false,
"data": {
"7508d64f832fb06b8f82f78963b280ab": {
"result": [
{
"entities": [],
"errors": [
{
"code": "0",
"status": "500",
"title": "Internal Server Error",
"detail": "An exception occurred while executing 'INSERT INTO `product_visibility` (`id`, `product_id`, `product_version_id`, `sales_channel_id`, `visibility`, `created_at`) VALUES (?, ?, ?, ?, ?, ?)' with params [\"\\x8d\\x5a\\x7e\\x2b\\x2c\\x02\\x98\\x6a\\x92\\x4e\\xaf\\x3d\\x95\\x04\\x41\\x3c\", \"\\x7a\\x78\\x82\\x55\\xea\\xb9\\x6b\\xf5\\x10\\x02\\x82\\x9b\\x3a\\x6b\\xec\\xf2\", \"\\x0f\\xa9\\x1c\\xe3\\xe9\\x6a\\x4b\\xc2\\xbe\\x4b\\xd9\\xce\\x75\\x2c\\x34\\x25\", \"\\x8e\\x7c\\x11\\xe2\\x54\\x0b\\x4c\\x71\\xb5\\x21\\xd5\\xa5\\x99\\x20\\xe1\\x42\", 30, \"2021-02-22 11:36:18.099\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'zx\\x82U\\xEA\\xB9k\\xF5\\x10\\x02\\x82\\x9B:k\\xEC\\xF2-\\x0F\\xA9\\x1C\\x...' for key 'uniq.product_id__sales_channel_id'"
}
]
}
],
"extensions": []
}
},
"extensions": []
}
I just figured out, that it's possible to extract the nested entities into separate actions (that works):
{
"7508d64f832fb06b8f82f78963b280ab": {
"action": "upsert",
"entity": "product",
"payload": [
{
"id": "7508d64f832fb06b8f82f78963b280ab",
"__code": "1111111189",
"stock": 99,
"taxId": "d390c2f211144543845dbf76fa69d17a",
"cmsPageId": null,
"deliveryTimeId": null,
"manufacturerId": null,
"unitId": null,
"price": [
{
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"net": 25,
"gross": 29.75,
"linked": true
}
],
"productNumber": "1111111189",
"coverId": null,
"translations": {
"ce1df85b5f1c4eedbc532cbd34c57df6": {
"name": "Converse black",
"description": "Converse black"
},
"2fbb5fe2e29a4d70aa5854ce7ce3e20b": {
"name": "Converse black",
"description": "Converse black"
}
},
"categories": [
{
"id": "e90cf50735a0d6f69b2dbf599caa4954"
},
{
"id": "a5b4753f41c8f4bedba1bf5954c961cb"
}
],
"properties": [
{
"id": "a01a0380ca3c61428c26a231f0e49a09"
}
],
"media": [
{
"id": "cb9a886400616c215a588b13cb7c662b",
"mediaId": "a7aabb5ff4dc3c99ba45724ec7477ffe"
}
],
"parent": {
"id": "7a788255eab96bf51002829b3a6becf2",
"__code": "1111111189",
"stock": 99,
"taxId": "d390c2f211144543845dbf76fa69d17a",
"cmsPageId": null,
"deliveryTimeId": null,
"manufacturerId": null,
"unitId": null,
"price": [
{
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
"net": 25,
"gross": 29.75,
"linked": true
}
],
"productNumber": "converseblack",
"coverId": null,
"translations": {
"ce1df85b5f1c4eedbc532cbd34c57df6": {
"name": "Converse black",
"description": "Converse black"
},
"2fbb5fe2e29a4d70aa5854ce7ce3e20b": {
"name": "Converse black",
"description": "Converse black"
}
},
"categories": [
{
"id": "e90cf50735a0d6f69b2dbf599caa4954"
},
{
"id": "a5b4753f41c8f4bedba1bf5954c961cb"
}
],
"properties": [
{
"id": "a01a0380ca3c61428c26a231f0e49a09"
}
],
"media": [
{
"id": "cb9a886400616c215a588b13cb7c662b",
"mediaId": "a7aabb5ff4dc3c99ba45724ec7477ffe"
}
],
"configuratorSettings": [
{
"optionId": "a01a0380ca3c61428c26a231f0e49a09",
"id": "db3787abb8d6372e1997c144031ef1e2"
}
]
},
"parentId": "7a788255eab96bf51002829b3a6becf2",
"options": [
{
"id": "a01a0380ca3c61428c26a231f0e49a09"
}
]
}
]
},
"e24f994426246015347bba784ac69a97": {
"action": "upsert",
"entity": "product_visibility",
"payload": [
{
"id": "e24f994426246015347bba784ac69a97",
"productId": "7508d64f832fb06b8f82f78963b280ab",
"salesChannelId": "8e7c11e2540b4c71b521d5a59920e142",
"visibility": 30
}
]
},
"8d5a7e2b2c02986a924eaf3d9504413c": {
"action": "upsert",
"entity": "product_visibility",
"payload": [
{
"id": "8d5a7e2b2c02986a924eaf3d9504413c",
"productId": "7a788255eab96bf51002829b3a6becf2",
"salesChannelId": "8e7c11e2540b4c71b521d5a59920e142",
"visibility": 30
}
]
}
}

Adaptive Cards doesn't work in MBF's Emulator running in Ubuntu 16.04

I am trying to implement AdaptiveCard into one of my dialogs using node.js. However once I run the emulator I get the following message instead of rendered AdaptiveCard:
[File of type 'application/vnd.microsoft.card.adaptive'].
Can anyone tell me what can be the problem?
I am running on Ubuntu 16.04, MBF Emulator v.3.5.31-alpha, microsoft-adaptivecards v.0.6.1.
Here is code from inside of one of my dialogs:
var msg = new builder.Message(session)
.addAttachment({
contentType: "application/vnd.microsoft.card.adaptive",
content: {
type: "AdaptiveCard",
body: [
{
"type": "TextBlock",
"text": msg_text,
},
{
"type": "Input.ChoiceSet",
"id": "myColor4",
"isMultiSelect": true,
"value": "1",
"style": "expanded",
"choices": [
{
"title": "Red",
"value": "1",
"isSelected": true
},
{
"title": "Green",
"value": "2"
},
{
"title": "Blue",
"value": "3",
"isSelected": true
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Sent",
"data": {
"myProperty": 12
}
}
],
}
});
session.send(msg);
This is detailed response, it contains all elements of the AdaptiveCard that I declared(but still it does not render):
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "What color do you want?"
},
{
"type": "Input.ChoiceSet",
"id": "myColor4",
"isMultiSelect": true,
"value": "1",
"style": "expanded",
"choices": [
{
"title": "Red",
"value": "1",
"isSelected": true
},
{
"title": "Green",
"value": "2"
},
{
"title": "Blue",
"value": "3",
"isSelected": true
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Sent",
"data": {
"myProperty": 12
}
}
]
}
}
],
"locale": "en-US",
"localTimestamp": "2017-09-17T19:21:17+02:00",
"from": {
"id": "default-bot",
"name": "Bot"
},
"recipient": {
"id": "default-user"
},
"inputHint": "acceptingInput",
"id": "heam84b9dn5b",
"replyToId": "71j1d6mbmk3l",
"channelId": "emulator",
"timestamp": "2017-09-17T17:21:17.379Z",
"conversation": {
"id": "fdikc23llm5"
}
}

Resources