I am not a developer so I apologize in advance if my question is really basic. I've managed to successfully install this Google script Twitter API integration below and send tweets from a Google sheet (the code was offered here). I simply use =sendTweet(message) in a cell, replacing message with the cell reference of where i have the text for the tweet, for example =sendTweet(C6) and the new Tweet will contain the pre-prepared text in cell C6.

What i'm trying to do is to add to the script the option of sending a tweet in reply to another tweet. Reading on Twitter's API documentation, I understand that the in_reply_to_status_id parameter needs to pass the in_reply_to_status_id in the API call URL but that's as far as my understanding goes.

I don't know how to define this new tweet_id variable and how to get it to pass the in_reply_to_status_id=tweet_id string in the right place so it will function. The ideal would be to use the same formula but with the addition of tweet_id for the reply, as a second variable. For example =sendTweet(message, tweet_id).

Your help would be much appreciated 🙏

// User-level Twitter API request // Requires the OAuth1 library to be pasted into the script. // https://developers.google.com/google-ads/scripts/docs/examples/oauth10-library var CONSUMER_KEY = '************************'; var CONSUMER_SECRET = '************************'; var ACCESS_TOKEN = '************************'; var ACCESS_SECRET = '************************'; /**  * Sends a tweet.  * @param {string} message The message to send.  * @return {?Object} The complex response object with the status of the send  *     request. See https://dev.twitter.com/rest/reference/post/statuses/update  *     for the structure of this object.  */ function sendTweet(message) {   if (typeof OAuth1 === 'undefined') {     var libUrl = 'https://developers.google.com/google-ads/scripts/docs/examples/oauth10-library';     throw Error('OAuth1 library not found. Please take a copy of the OAuth1 ' +         'library from ' + libUrl + ' and append to the bottom of this script.');   }   var params = '';   var tweet = message.substring(0, 160);   var options = {method: 'POST', payload: {status: tweet}};   var authUrlFetch = OAuth1.withAccessToken(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET);   var response = authUrlFetch.fetch('https://api.twitter.com/1.1/statuses/update.json', params, options);   var responseText = response.getContentText();   return JSON.parse(responseText); } 

I have created a script in GoogleAds to fetch this report: https://developers.google.com/adwords/api/docs/appendix/reports/product-partition-report from GoogleAds and insert the result as a table in BigQuery using the AdvanceAPI in GoogeAds.

The script I am running is built according to this sample code: https://developers.google.com/adwords/api/docs/appendix/reports/product-partition-report, provided by the Google Ads Script Team and they have also tried to help me in this matter.

The issue I am facing is that the first run of the script runs perfectly and creates a table in BQ and inserts the data as intended. However, when the script runs again (as sheduled 3 PM everyday) to get updated data from GoogleAds I get the following error message: API call to bigquery.tables.insert failed with error: Already Exists

The error message also provides the information that the issue is somewhere in this code:

table.tableReference = BigQuery.newTableReference(); table.tableReference.datasetId = CONFIG.BIGQUERY_DATASET_ID; table.tableReference.projectId = CONFIG.BIGQUERY_PROJECT_ID; table.tableReference.tableId = reportConfig.NAME; table = BigQuery.Tables.insert(table, CONFIG.BIGQUERY_PROJECT_ID,     CONFIG.BIGQUERY_DATASET_ID); 

But all this chunk of code is provided from the Google Ads Script Team so there should not be any problem with this?

So happy if someone could give me any guidance how to solve this!

Thanks in advance.

My question is the same as described here: How to set request header in google ads api but I'm still facing the problem.
I'm trying to make an API call to google ads. I tried Rest API as well as google.ads.google_ads library. Both ways fail. I followed all Oath2 steps and got all ids, tokens, secrets, etc. The Rest API call is :

refresh_token = MY_REFRESH_TOKEN customer_id = 7868****** developer_token = MY_DEVELOPER_TOKEN access_token =  MY_ACCESS_TOKEN url = 'https://googleads.googleapis.com/v6/customers/{}/campaignBudgets:mutate'.format(customer_id) headers = {'developer-token':developer_token,"Authorization": "Bearer {}".format(access_token),'login-customer-id':'2693******',"Content-Type": "application/json"} response = requests.post(url,headers = headers) print(response.text) 

and this is the response:

{   "error": {     "code": 401,     "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",     "status": "UNAUTHENTICATED"   } } 

Why? I provided an access token.

I also tried the "google-ads" code I found in the documentation:
https://developers.google.com/google-ads/api/docs/reporting/example
I generated a googleads.ymal file, with the following content:

developer_token: MY_DEVELOPER_TOKEN user_agent: MY_COMPANY_NAME client-id: 7868****** login-customer-id: 2693****** client_id: MY_CLIENT_ID client_secret: MY_CLIENT_SECRET refresh_token: MY_REFRESH_TOKEN 

and this is what I get:

Error with message "User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header 

and again I don't understand why. My user was the one to generate all login details, and it has access to the manager account, which listed as "login-customer-id".

Can anyone shed some light?

Thanks

Try running the example get_campaign.py in the google ads api. The code was entered as follows

import argparse import sys from google.ads.google_ads.client import GoogleAdsClient from google.ads.google_ads.errors import GoogleAdsException def main(client, customer_id):     ga_service = client.get_service("GoogleAdsService", version="v6")     query = """         SELECT campaign.id, campaign.name         FROM campaign         ORDER BY campaign.id"""     # Issues a search request using streaming.     response = ga_service.search_stream(customer_id, query=query)     try:         for batch in response:             for row in batch.results:                 print(                     f"Campaign with ID {row.campaign.id} and name "                     f'"{row.campaign.name}" was found.'                 )     except GoogleAdsException as ex:         print(             f'Request with ID "{ex.request_id}" failed with status '             f'"{ex.error.code().name}" and includes the following errors:'         )         for error in ex.failure.errors:             print(f'\tError with message "{error.message}".')             if error.location:                 for field_path_element in error.location.field_path_elements:                     print(f"\t\tOn field: {field_path_element.field_name}")         sys.exit(1) if __name__ == "__main__":     # GoogleAdsClient will read the google-ads.yaml configuration file in the     # home directory if none is specified.     google_ads_client = GoogleAdsClient.load_from_storage('C:/Users/GoogleAPI/googleads.yaml')     parser = argparse.ArgumentParser(         description="Lists all campaigns for specified customer."     )     # The following argument(s) should be provided to run the example.     parser.add_argument(         "-c",         "--customer_id",         type=str,         required=True,         help="The Google Ads customer ID.",     )     args = parser.parse_args()     print(args.customer_id)     main(google_ads_client, args.customer_id) 

But I get this error.

 errors {   error_code {     authorization_error: USER_PERMISSION_DENIED   }   message: "User doesn\'t have permission to access customer. Note: If you\'re accessing a client customer, the manager\'s customer id must be set in the \'login-customer-id\' header. See https://developers.google.com/google-ads/api/d ocs/concepts/call-structure#login-customer-id" } 

customer id works fine for google adwords api.

If anyone knows the answer, I would appreciate it if you let me know. Thank you.