Posts tagged with node.js

We are using Google ads API and we are getting the refresh_token and access_token from the oauthLibrary.

Now due to some reason (Majorly cause we are using JavaScript and there's no library for JavaScript officially from Google) we are relying on the REST API.

I want to fetch a list of Accounts attached to the the given access token. (no matter manager or not Manager) I just need the list.

I have tried the following endpoint

https://googleads.googleapis.com/v1/customers:listAccessibleCustomers

But I am getting 404 Not found in that, So I think it is discontinued, Any idea how I can fetch the list through REST_API.

usually we add a script to our website to track conversion for google analytics. Is there any way send the data from plain javascript code such as in the case of Facebook. for example:

'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const Content = bizSdk.Content; const CustomData = bizSdk.CustomData; const DeliveryCategory = bizSdk.DeliveryCategory; const EventRequest = bizSdk.EventRequest; const UserData = bizSdk.UserData; const ServerEvent = bizSdk.ServerEvent; const access_token = '<ACCESS_TOKEN>'; const pixel_id = '<ADS_PIXEL_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); let current_timestamp = Math.floor(new Date() / 1000); const userData = (new UserData())                 .setEmails(['joe@eg.com'])                 .setPhones(['12345678901', '14251234567'])                 // It is recommended to send Client IP and User Agent for Conversions API Events.                 .setClientIpAddress(request.connection.remoteAddress)                 .setClientUserAgent(request.headers['user-agent'])                 .setFbp('fb.1.1558571054389.1098115397')                 .setFbc('fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890'); const content = (new Content())                 .setId('product123')                 .setQuantity(1)                 .setDeliveryCategory(DeliveryCategory.HOME_DELIVERY); const customData = (new CustomData())                 .setContents([content])                 .setCurrency('usd')                 .setValue(123.45); const serverEvent = (new ServerEvent())                 .setEventName('Purchase')                 .setEventTime(current_timestamp)                 .setUserData(userData)                 .setCustomData(customData)                 .setEventSourceUrl('http://jaspers-market.com/product/123')                 .setActionSource('website'); const eventsData = [serverEvent]; const eventRequest = (new EventRequest(access_token, pixel_id))                 .setEvents(eventsData); eventRequest.execute().then(   response => {     console.log('Response: ', response);   },   err => {     console.error('Error: ', err);   } );

or we can do something like: To send new events, make a POST request to this API's /events edge from this path: https://graph.facebook.com/{API_VERSION}/{PIXEL_ID}/events?access_token={TOKEN}. When you post to this edge, Facebook creates new server events.

I am using google-ads-api module in nodejs to connect with Google Ads API.

I am using this code block to get Customer

const customer = client.Customer({     customer_id: 'XXX-XXX-XXXX',     refresh_token: refreshToken, }) 

I have used XXX-XXX-XXXX, XXXXXXXXXX, XXXX-XXX-XXX format for customer_id but still it is returning this error

GoogleAdsFailure {   errors: [     GoogleAdsError {       error_code: [ErrorCode],       message: "Invalid customer ID ''."     }   ],   request_id: 'OcUdfalh_N0U4hTJUd6c6g' } 

My requirement is to send whatsapp message from the web page. So, it should be a single page which will have fields To Mobile number, message and send button.

I found the documentation from facebook that we need to get whatsapp business api for this. I also see some other tools like twilio to achieve this. It is just confusing that, If we can achieve it using whatsapp business api itself, why we require twilio So, My question here is, Is twilio or other third party tools really require to access whatsapp api.

Note: i am planning to do this implementation with node js.

Please clarify.