Google Contacts API learn is contact google+ or not - node.js

I'm using Google Contacts API to get user's contacts in my NodeJS app and I need to check, has contact google+ or not, but I can't find a way to do it in docs. Currently I'm receiving response from API that looks like this:
{ id: { '$t': 'http://www.google.com/m8/feeds/contacts/ex%40domain.com/base/40411dcf8aeb5354' },
updated: { '$t': '2016-08-12T08:03:22.026Z' },
category:
[ { scheme: 'http://schemas.google.com/g/2005#kind',
term: 'http://schemas.google.com/contact/2008#contact' } ],
title: { type: 'text', '$t': 'TestGoogleContact' },
link:
[ { rel: 'http://schemas.google.com/contacts/2008/rel#edit-photo',
type: 'image/*',
href: 'https://www.google.com/m8/feeds/photos/media/ii%40risingapp.com/40411dcf8aeb5354/1B2M2Y8AsgTpgAmY7PhCfg' },
{ rel: 'self',
type: 'application/atom+xml',
href: 'https://www.google.com/m8/feeds/contacts/ii%40risingapp.com/full/40411dcf8aeb5354' },
{ rel: 'edit',
type: 'application/atom+xml',
href: 'https://www.google.com/m8/feeds/contacts/ii%40risingapp.com/full/40411dcf8aeb5354/1470989002026004' } ],
'gd$email':
[ { address: 'testcontact#somedomain.com',
primary: 'true',
rel: 'http://schemas.google.com/g/2005#home' } ] }

Contacts API pre-dates Google+ so profile information is not available. A feature was added later to show just the G+ photo from the profile if a the user set one, which could be a hacky/flakey heuristic to check for a profile. However, you can easily get this information by using the People API instead, which joins G+ profile information onto contacts and will likely replace the Contacts API eventually: https://developers.google.com/people/

Related

"You cannot specify a different service agreement in FI" returned from Stripe

I am triying to create stripe connected account in testing mode referencing
service_agreement: 'recipient'
here with the full code I wrote:
account = Stripe::Account.create(
type: 'custom',
business_type: 'company',
email: account_params[:email],
external_account: "btok_us_verified",
capabilities: {
transfers: {requested: true}
},
company: {
name: "Test Company name 6",
tax_id: "000000000",
},
tos_acceptance: {
service_agreement: 'recipient',
date: Time.now.to_i,
ip: request.remote_ip,
}
)
After I made the call stripe returned this error.
You cannot specify a different service agreement in FI.
But stripe docs says recipient service agreement is available.
Can anyone help me to figure out this issue.
This should be possible, or at least it worked when I tested using my test US-based platform. You may need to explicitly specify the account country=FI:
account = Stripe::Account.create(
type: 'custom',
**country: 'FI',**
business_type: 'company',
email: account_params[:email],
external_account: "btok_us_verified",
capabilities: {
transfers: {requested: true}
},
company: {
name: "Test Company name 6",
tax_id: "000000000",
},
tos_acceptance: {
service_agreement: 'recipient',
date: Time.now.to_i,
ip: request.remote_ip,
}
)
If this does not resolve it for you I can create a test FI platform to try myself.

Docusign Text Tabs in template not populating

I am using docusign (production account) to allow users to sign documents. I am trying to add data to textTabs that I create through the docusign dashboard. So say if I add a text box and call it nbShares, the below code does not populate the box. All the boxes I add in the dashboard such as signature, text, checkboxes etc are not shown in the generated link. I get no API errors either. I also tried to create customFields, and pass data to them as textTab - however this did not work either.
I think I may misunderstand the flow, I add all recipients and signers programatically - is that why I cant see the placeholders/buttons I add? I have also allowed collaboration in the fields I add, made them mandatory - yet they still do not appear.
Would really appreciate some help on this. This is my envelope definition - Im using the node sdk along with ts types.
const makeEnvelopeDefinition = async (
templateName: string,
user: User,
dealId?: string,
): Promise<EnvelopeDefinition> => {
const personToSign: Signer = {
email: user.email,
name: user.name,
roleName: 'Signer',
// Should this work?
tabs: {
textTabs: [
{ tabLabel: 'nbShares', value: '1000' },
],
},
clientUserId: DOCUSIGN_CLIENT_USER_ID,
recipientId: '1',
}
const compositeTemplate: CompositeTemplate = {
serverTemplates: [
{ sequence: '1', templateId: 'remote-template-id' },
],
inlineTemplates: [
{
sequence: '1',
recipients: {
signers: [personToSign],
certifiedDeliveries: [
{
email: 'someemail#something.com',
recipientId: '77',
name: 'Receipt of transaction',
},
{
email: user.email,
recipientId: '771',
name: user.name,
},
],
},
},
],
}
// create the envelope definition
const envelope: EnvelopeDefinition = {
emailSubject: 'Review signed document',
status: 'sent',
compositeTemplates: [compositeTemplate],
}
return envelope
}
For me the solution was changing my signer to this
const personToSign: Signer = {
email: user.email,
name: user.name,
clientUserId: await getDocusignConfig().DOCUSIGN_CLIENT_USER_ID,
recipientId: '1',
routingOrder: '1', // Was missing this
roleName: 'Signer', // Must match signer specified on docusign dashboard
tabs: {
textTabs: [
{
xPosition: '150',
yPosition: '200',
name: 'First Name',
tabLabel: 'name', // Must match the dataLabel name specified on docusign
value: 'Test',
},
],
},
}
And enabling this setting 'When an envelope is sent, write the initial value of the field for all recipients' in 'Signing Settings' on docusign.

Custom payload for platforms like Telegram, Facebook, Slack for DialogFlow in Nodejs

I would like to ask how to custom payload for carousel, image in other platforms like Facebook, Telegram and etc.
Information
DialogFlow API version: V2 API
Node version: v8.10.0
body-parser version: ^1.18.3
express: ^4.16.4
return res.json({
payload: {
google: {
expectUserResponse: true,
systemIntent: {
intent: "actions.intent.OPTION",
data: {
"#type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
carouselSelect: {
items: [{
optionInfo: {
key: "car",
synonyms: ["automobile", "vehicle"]
},
description: "A four wheel vehicle",
title: "Car"
},
{
optionInfo: {
key: "plane",
synonyms: ["aeroplane", "jet"]
},
description: "A flying machine",
title: "Plane"
}
]
}
}
},
richResponse: {
items: [{
simpleResponse: {
textToSpeech: "Category List"
}
}]
}
},
telegram: {
text: "Category list",
expectUserResponse: true,
systemIntent: {
intent: "actions.intent.OPTION",
data: {
"#type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
carouselSelect: {
items: [{
optionInfo: {
key: "car",
synonyms: ["automobile", "vehicle"]
},
description: "A four wheel vehicle",
title: "Car"
},
{
optionInfo: {
key: "plane",
synonyms: ["aeroplane", "jet"]
},
description: "A flying machine",
title: "Plane"
}
]
}
}
}
}
},
outputContexts: []
});
This is code snippet to return carousel response to Telegram and Google. It worked in google assistant but failed to display carousel list in Telegram. Only text "Category list" was displayed in Telegram.
Is there any mistake in the payload for Telegram? Could anyone provide guidance on this?
Option responses(such as Carousel and List) are response type of actions-on-google modules and it is created for Google Assistant. Every platform has different screen abilities so you can not use every response type for every platform. As far as I know, there is no carousel or list type supported by Telegram. You may consider to use different options. For more information you may check out :
Rich messages

loopback authenticating rest api url

i have created an endpoint to download csv file but i want to authenticate the endpoint before download, i.e. it should ask for username and password and if verified then only download of csv should happen. i want to do it with loopback only. Any help appreciated. Thanku.
my code for csv download-
Transaction.csvexport = function(type, res, callback) {
res.set('Content-Type','application/download');
res.set('Content-Disposition','attachment;filename=Data.csv');
res.set('Content-Transfer-Encoding','binary');
res.send('ok;'); //#todo: insert CSV data here.
};
Transaction.remoteMethod('csvexport',
{
accepts: [
{arg: 'type', type: 'string', required: true },
{arg: 'res', type: 'object', 'http': {source: 'res'}}
],
returns: {},
http: {path: '/csvexport/:type', verb: 'get'}
});
Authentication is not enabled by default on Loopback. You can create users and set ACLs with the framework. Check out the documentation for more info.

adding custom metrics to countly

I have a local countly installation, I have been able to make it multi tenet, now any dev from my organization can make an account on it, make applications under his account, and send data on it.
We would like to add some more data to our dashboard, like "Gender","age" e.t.c, and that I suppose will be in form of another metric like "device details" and "carriers", I would like know how do we add a custom metric to it.
I am new to nodejs and express, but I am getting hang of it, so just elementary know how will do, anyways I am reading code at the moment, so If I realize how to do it, i'll post it here as well.
There is a generic piece of code which gets the params from incoming http request, and throws them to the db, like all other params, the new collection is also made by this process automatically.
in file api/parts/data/usage.js
var predefinedMetrics = [
{ db: "devices", metrics: [{ name: "_device", set: "devices", short_code: common.dbUserMap['device'] }] },
{ db: "carriers", metrics: [{ name: "_carrier", set: "carriers", short_code: common.dbUserMap['carrier'] }] },
{ db: "device_details", metrics: [{ name: "_os", set: "os", short_code: common.dbUserMap['platform'] }, { name: "_os_version", set: "os_versions", short_code: common.dbUserMap['platform_version'] }, { name: "_resolution", set: "resolutions" }] },
{ db: "app_versions", metrics: [{ name: "_app_version", set: "app_versions", short_code: common.dbUserMap['app_version'] }] },
{ db: "gender", metrics: [{ name: "_gender", set: "gender", short_code: common.dbUserMap['gender'] }] }]
I just added gender to this list of predefined metrices, and now when i send the gender along with my http request, it gets saved easily.
Now I am working on rendering it on dashboard.

Resources