Phonenumber from Google Contacts API 3 - javascript

I'm developing and application in javascript. I need to get my gmail contacts and their phone numbers.
I have tried the "Sample - Oauth Contacts" from https://developer.chrome.com/extensions/samples.html and it works, but it does not retrieve the phonenumber.
According to the documentation in https://developers.google.com/google-apps/contacts/v3/ it should retrieve a tag like this:
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'
primary='true'>
456
</gd:phoneNumber>
but it does not appear. It only gets the name (title), ID, and email.
Do you know if I am missing something? Is there any restriction on using this API from a google extension?
Thanks in advance!!

Related

Google Analytics: User does not have sufficient permissions for this profile

I am unable to access the Google Analytics API from rails. I keep getting insufficient permissions even though I have already set the service account.
I have created a service account:
Go to the project in console.developers.google.com/iam-admin/serviceaccounts
I go to Service Accounts > Create Service Accounts
Then select account and add a key. This will download a JSON file with the service account.
After having the service account and have the secret JSON file and the email. Then I go to Google Analytics:
Go to Admin > Select Property > Property User Management > Add User
Copy the Service Account email and select Read & Analyze
Once I have that, pretty much use the following code: https://gist.github.com/CoryFoy/9edf1e039e174c00c209e930a1720ce0 to get the reports.
But I keep getting forbidden: User does not have sufficient permissions for this profile. Even when I try to get the access_token and use it in javascript:
gapi.analytics.auth.authorize({
serverAuth: {
access_token: 'accessToken'
}
});
I get:
error:{
code: 403
errors: [
{
domain: "global"
message: "User does not have sufficient permissions for this profile."
reason: "insufficientPermissions"
}
]
}
Am I missing something? This used to work and I never had a problem with it, but for some reason it stopped working. Any guidance will be appreciate it.
Thank you!
UPDATE
UA (Universal Analytics) will stop processing data on July 1st 2023. It means will stop support for it, so you will need to update to Analytics 4.
Articles by Google
Universal Analytics will be going away
[GA4] Introducing the next generation of Analytics, Google Analytics 4
This has something to do with how you create an analytics property. Since they remove the views from analytics 4, now you need to create a universal analytics property.
In account click on "Create Property"
Fill the fields and click on "Show advance options"
Activate "Create a Universal Analytics property"
Add the website url in the field and then make sure "Create both a
Google Analytics 4 ...." and "Enable enhanced measure interactions on
your sites...." are marked.
Then click next and that is it.
The code stays the same as this is an analytics change.
UPDATE
UA (Universal Analytics) will stop processing data on July 1st 2023. It means will stop support for it, so you will need to update to Analytics 4.
Articles by Google
Universal Analytics will be going away
[GA4] Introducing the next generation of Analytics, Google Analytics 4

How to get all contacts (sender, to, cc, etc) from a specific email using Outlook REST API with JavaScript?

I need to get all the contacts involved in a specific email (sender, to, cc, etc) then access to their job title, company, primary and mobile phone numbers using Outlook Rest API 2.0 with JavaScript.
I got the token and everything and so far I've been successful in getting all contacts using this:
https://outlook.office.com/api/v2.0/me/contacts
But I don't want all contacts from the whole mailbox, I just want the contacts from a specific email and get the data described above.
Any ideas on how to achieve this will be appreciated A LOT!!
Thanks in advance guys!!
checkout the below link.
https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/mail-rest-operations#get-messages
Response from the API has the sender object which has Sender, From, ToRecipients, CcRecipients, BccRecipients, etc.

Facebook Open Graph API - Fetch offers from page

I am currently working on a javascript project that fetches various data from a customer's Facebook page, so that it can be displayed on the customer's website.
One requirement of this project is that it can also fetch an display all offers that are currently active on the customer's Facebook page.
I already dug through the Open Graph API documentation and Facebook is listing two different endpoints to access offers from a Facebook page.
I tried /{PAGEID}/nativeoffers but this just gives me a empty response.
I also tried /{PAGEID}/offers_v3 but I just get the following error response:
{
"error": {
"message": "(#3) User must be on whitelist",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "BV8zwWvE7Gv"
}
}
Because of that, I have two questions:
If I just want to fetch the standard offers of a Facebook page, which API endpoint do I have to use? /nativeoffers or /offers_v3 ?
How to get whitelisted to use /offers_v3? In the Open Graph API docs the description is as follows:
Entity to describe an offer. One needs to be whitelisted to use this API. Please contact the support group and ask them to reach out to the team that is responsible for this API to request to be whitelisted.
What support group is meant here?
Any help is greatly appreciated!

How to get User's actual Email Id in Outlook Add-in Integration

I have integrated created one Add-In to be integrated in Outlook Mail.
I have used Office inbuilt code (Javascript Code) for it.
Now to test Add-in i have signup in Microsoft with my personal email id.After sign up i found that in Outlook Mail, there are two different Mail Ids in Profile.
like
alex.p#***.com
outlook_1203434#outlook.com
now i need the first one for validation but i am getting the second one every time.
I used below code for that.
Office.initialize = function (reason) {
item = Office.context.mailbox.item;
console.log(Office.context.mailbox.userProfile.displayName);
console.log(Office.context.mailbox.userProfile.emailAddress);
}
Please suggest me some other way to get the users email id.
The documentation for the Outlook JavaScript API ( https://dev.office.com/docs/add-ins/develop/understanding-the-javascript-api-for-office#mailbox-object ) implies that your code runs only within a mailbox context which only exposes that specific mailbox's data, so you cannot access any information about other mailboxes.
I had a quick search and I don't think it's possible to enumerate email addresses associated with a mailbox, nor information about other mailboxes in Desktop Outlook or whatever the OWA equivalent is.

Add Whatsapp function to website, like sms, tel

I have a website that a lot of people view on mobile.
I have link for : Call and SMS and I want to add one for Whatsapp, so a user can click the whatsapp link I create and start a conversation with me.
If this is possible can someone point me in the right direction on how?
below link will open the whatsapp. Here "0123456789" is the contact of the person you want to communicate with.
href="intent://send/0123456789#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end">
Check this link out
Launching Your iPhone App Via Custom URL Scheme
and more on the whats up url scheme document
I did a quick mock up and tried it on my iphone with a link like this from a webpage and it opened the app on my iphone.
whatsapp
I could not try to send a message as I don't have a current Whatsapp account sorry.
Add user name using abid parameter
let's say your whatsapp username was username then it would be
whatsapp
once again sorry I can't test this. Also I have no idea what would happen if the username is the actual user of the current mobile device. eg. You try to whatsapp yourself.
Here is the solution to your problem! You just need to use this format:
In the place of "urlencodedtext" you need to keep the content in Url-encode format.
UPDATE-- Use this from now(Nov-2018)
Use: https://wa.me/15551234567
Don't use: https://wa.me/+001-(555)1234567
To create your own link with a pre-filled message that will
automatically appear in the text field of a chat, use
https://wa.me/whatsappphonenumber/?text=urlencodedtext where
whatsappphonenumber is a full phone number in international format and
URL-encodedtext is the URL-encoded pre-filled message.
Example:https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale
To create a link with just a pre-filled message, use
https://wa.me/?text=urlencodedtext
Example:https://wa.me/?text=I'm%20inquiring%20about%20the%20apartment%20listing
After clicking on the link, you will be shown a list of contacts you
can send your message to.
For more information, see https://www.whatsapp.com/faq/en/general/26000030
This is possible by creating the following link:
whatsapp://send?text=Hello this has been opened from the browser&phone=+PHONENUMBER&abid=+PHONENUMBER
Thanks to:
https://forum.ionicframework.com/t/open-whatsapp-intent-with-msg-specific-contact/73903/4
I have tested this on iOS, Windows Phone and Android
I just posted an answer on a thread similiar to this here https://stackoverflow.com/a/43357241/3958617
The approach with:
whatsapp
and with
whatsapp
Only works if the person who clicked on your link have your number on their contact list.
Since not everybody will have it, the other solution is to use Whatsapp API like this:
Send Message
More details on this API here: https://www.whatsapp.com/faq/en/general/26000030
And observations on how to use it here: https://stackoverflow.com/a/43357241/3958617
Use:
https://wa.me/YOURNUMBER
where YOURNUMBER is without the two leading 00.
For instance for +37061204312 you write:
https://wa.me/37061204312
This link seems to work on mobiles and on desktop computers.
To prefill the message with text you can use:
https://wa.me/YOURNUMBER/?text=urlencodedtext
More in the Whatsapp FAQ: https://faq.whatsapp.com/en/android/26000030/
Rahul's answer gives me an error: You seem to be trying to send a WhatsApp message to a phone number that is not registered with WhatsApp..., even though I'm sending it to a registered WhatsApp number.
This, however works:
<li><a href="intent:0123456789#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end"><i class="fa fa-whatsapp"></i>+237 655 421 621</li>

Categories