credentials must be a ChannelCredentials object
An error occurred while executing the 'customer.conversionActions.create' method. 'Channel credentials must be a ChannelCredentials object', The configuration information of my 'googleClientConfiguration' can be executed successfully in the Python version of SDK. Did I write it? Is there any problem?
import { GoogleAdsApi, services, enums } from 'google-ads-api';
function getCustomer(googleClientConfig: any, customerId: string): Customer { const { client_id: clientId, client_secret: clientSecret, developer_token: developerToken, refresh_token: refreshToken, login_customer_id: loginCustomerId, } = googleClientConfig; const client = new GoogleAdsApi({ client_id: clientId, client_secret: clientSecret, developer_token: developerToken, }); const customer = client.Customer({ customer_id: customerId, refresh_token: refreshToken, login_customer_id: loginCustomerId, }); return customer; }
const customerId = 'xxxxxxxx'; const googleClientConfig = { client_id: 'xxxx', client_secret: 'xxxxx', developer_token: 'xxxx', refresh_token: 'xxxx', login_customer_id: 'xxxxx' };
const customer = getCustomer(googleClientConfig, customerId); res = await customer.conversionActions.create([{ name: ’xxxxxxx‘, status: enums.ConversionActionStatus.ENABLED, click_through_lookback_window_days: 90, type: enums.ConversionActionType.UPLOAD_CLICKS, category: enums.ConversionActionCategory.DEFAULT, }]);