Posts tagged with node.js

While working on WhatsApp Business Cloud API, I have to send an Image through WhatsApp. When I send that image I am getting a response as a sha256 base64 string and an imageId. I want to retrieve back that image using these credentials. I'm getting a URL when I make a get request with that image id. That URL is actually broken/invalid and I'm not getting the image back.

Response of the request is given below :

"messages": [               {                 "from": "918******6",                 "id": "wamid.HBgMOT*********EA",                 "timestamp": "1655978686",                 "type": "image",                 "image": {                   "mime_type": "image/jpeg",                   "sha256": "ian**********jM4k=",                   "id": "4**********7"                 }               }             ] 

Iam trying to use gupshup whatsapp business api through template.

My template expects a link url for the attachment therefore iam building an url through buffer in nodejs and having given response type for the link url as this.

       statusCode: 200,        headers: {            "content-type": "application/pdf",            'content-disposition': 'inline; filename=suresign.pdf',            'Accept-Ranges': 'bytes',            'Content-Length': buffer.length,        },        body: buffer.toString('base64'),        isBase64Encoded: true    }``` Iam able to generate message id ```{"messageId":"8427c6aa-8140-4d79-a835-ba8f44f6c867","status":"submitted"}``` but in gupshup callback response im getting error as this ```{    "app": "SureCredsLIVE",    "timestamp": 1654016941604,    "version": 2,    "type": "message-event",    "payload": {        "id": "8427c6aa-8140-4d79-a835-ba8f44f6c867",        "type": "failed",        "destination": "918553220750",        "payload": {            "code": 1011,            "reason": "Invalid Media Size"        }    } }```

I am trying to find the total cost of google ads campaigns that are created via a particular manager account or via google ads api.

I tried the change event query where it gives me all the campaigns created via google ads but the issue is with change_event.change_date_time. It requires this filter otherwise it throws an error. Because of this filter, I am only getting campaigns that are created in this specific time period, but I need all campaigns.

SELECT   change_event.campaign FROM change_event WHERE   campaign.status != 'REMOVED'   AND change_event.change_date_time >= '${from_date}'   AND change_event.change_date_time <= '${to_date}'   AND change_event.client_type = 'GOOGLE_ADS_API' ORDER BY change_event.change_date_time ASC LIMIT 10000 

Reference Link: https://developers.google.com/google-ads/api/fields/v9/change_event_query_builder

I'm integrating Google Ads Rest API.I want to pass an array of type UserIdentifier to a function where each object should only have one item only because it is required by this Google Ads API for example:

f([{hashedEmail: "xxxxxx"}, {hashedPhoneNumber: "xxxxxx"}]) // OK f([{hashedEmail: "xxxxxx", hashedPhoneNumber: "xxxxxx"}]) // Not Cool 

This example comes close but I only want to use the keys that are mentioned in Google Ads API UserIdentifier type.

Thanks in advance.