I am using ads API for getting the spends based on state names of USA.

The below query gives segments.geo_target_state will be returned as an ID instead of name How can I combine this query with

SELECT  geo_target_constant.name,  geo_target_constant.canonical_name  FROM geo_target_constant  WHERE geo_target_constant.id = <<OBTAINED ID FROM THE BELOW QUERY>> 
curl "https://googleads.googleapis.com/v10/customers/${CUSTOMER_ID}/googleAds:searchStream" \   --header "Content-Type: application/json" \   --header "developer-token: ${DEVELOPER_TOKEN}" \   --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \   --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \   --data '{     "query": "       SELECT         campaign.name,         segments.geo_target_state,         metrics.cost_micros       FROM geographic_view       WHERE         geographic_view.location_type = LOCATION_OF_PRESENCE         AND segments.date BETWEEN 20220101 AND 20220430     "   }' 

That is geoTargetConstants/21136 must be decoded to "name": "New Jersey",

 "results": [             {                 "campaign": {                     "resourceName": "customers/1234/campaigns/1234",                     "name": "Display - macines - Leads Display Campaign Test - AA"                 },                 "metrics": {                     "costMicros": "66664821"                 },                 "segments": {                     "geoTargetState": "**geoTargetConstants/21136**"                 },                 "geographicView": {                     "resourceName": "customers/6383148790/geographicViews/2840~LOCATION_OF_PRESENCE"                 }             }, 

let startDate = '2020-01-01'; let endDate = new Date().toISOString().slice(0, 10).toString(); // "WHERE segments.date BETWEEN '2020-01-01' AND 'endDate' " 

Returns this error:

Exception: Call to GoogleAdsService.Search failed: Condition 'segments.date BETWEEN '2020-01-01' and 'endDate'' is invalid: BETWEEN operator must have exactly two values that are both numbers or both date strings in 'YYYY-MM-DD' format.

How can I set endDate to YESTERDAY?

I am facing this error on flutter native ads (android):

PlatformException(NativeAdError, Can't find NativeAdFactory with id: homeScreen, null, null)

google_mobile_ads: ^0.13.0 

this is my HomeScreenNativeAd.kt file

class HomeScreenNativeAd(val context: Context) : GoogleMobileAdsPlugin.NativeAdFactory{     override fun createNativeAd(             nativeAd: NativeAd,             customOptions: MutableMap<String, Any>?     ): NativeAdView {         val homeScreenNativeView = LayoutInflater.from(context)                 .inflate(R.layout.home_screen_native_ad, null) as NativeAdView         with(homeScreenNativeView) {             val attributionViewSmall =                     findViewById<TextView>(R.id.tv_home_item_native_ad_attribution_small)             val icon = findViewById<ImageView>(R.id.home_item_bg_image)             val image = nativeAd.icon             if (image != null) {                 attributionViewSmall.visibility = View.VISIBLE                 icon.setImageDrawable(image.drawable)             } else {                 attributionViewSmall.visibility = View.INVISIBLE             }             this.iconView = iconView             val adV =   findViewById<TextView>(R.id.adviser)             adV.text = nativeAd.advertiser             this.advertiserView =adV             val ctaButton =   findViewById<TextView>(R.id.home_screen_cta_button)             ctaButton.text = nativeAd.callToAction             this.callToActionView = ctaButton             val adDesc =   findViewById<TextView>(R.id.home_item_ad_desc)             adDesc.text = nativeAd.body             this.bodyView = ctaButton             val headlineView = findViewById<TextView>(R.id.home_item_ad_title)             headlineView.text = nativeAd.headline             this.headlineView = headlineView             setNativeAd(nativeAd)         }         return homeScreenNativeView     } } 

home_screen_native_ad.xml file

`

<com.google.android.gms.ads.nativead.NativeAdView     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent">     <FrameLayout         android:layout_width="match_parent"         android:layout_height="match_parent">         <RelativeLayout             android:orientation="vertical"             android:layout_width="wrap_content"             android:layout_height="160dp">             <FrameLayout                 android:layout_width="match_parent"                 android:background="#00ffffff"                 android:layout_height="140dp"/>             <RelativeLayout                 android:layout_width="match_parent"                 android:layout_height="190dp"                 android:layout_marginTop="16dp"                 android:layout_marginEnd="16dp"                 android:layout_marginBottom="16dp"                 android:gravity="start"                 android:orientation="horizontal">                 <ImageView                     android:id="@+id/home_item_bg_image"                     android:layout_width="60dp"                     android:layout_height="60dp"                     android:scaleType="centerCrop"                     android:layout_marginLeft="16dp"                     />                 <TextView                     android:id="@+id/home_item_ad_title"                     android:layout_width="220dp"                     android:layout_height="wrap_content"                     android:layout_marginLeft="10dp"                     android:layout_toRightOf="@+id/home_item_bg_image"                     android:ellipsize="end"                     android:lines="1"                     android:maxLines="1"                     android:textColor="#FFFFFFFF"                     android:textSize="20sp"                     tools:text="Headline" />                 <TextView                     android:id="@+id/adviser"                     android:layout_width="229dp"                     android:layout_height="wrap_content"                     android:layout_marginLeft="10dp"                     android:layout_marginTop="32dp"                     android:layout_toRightOf="@+id/home_item_bg_image"                     android:ellipsize="end"                     android:lines="1"                     android:maxLines="1"                     android:textColor="#FFFFFFFF"                     android:textSize="14sp"                     tools:text="Advertiser" />                 <TextView                     android:id="@+id/tv_home_item_native_ad_attribution_small"                     android:layout_width="35dp"                     android:layout_height="20dp"                     android:layout_marginLeft="10dp"                     android:layout_toRightOf="@+id/home_item_ad_title"                     android:background="@color/softOrange"                     android:gravity="center"                     android:lines="1"                     android:maxLines="1"                     android:text="Ad"                     android:textColor="#FFFF"                     android:textSize="12sp" />             </RelativeLayout>             <TextView                 android:id="@+id/home_item_ad_desc"                 android:layout_width="270dp"                 android:layout_height="40dp"                 android:layout_marginTop="85dp"                 android:ellipsize="end"                 android:lines="2"                 android:gravity="center_vertical"                 android:maxLines="2"                 android:textColor="#FFFFFFFF"                 android:textSize="14sp"                 android:layout_marginLeft="16dp"                 tools:text="Headline" />             <TextView                 android:id="@+id/home_screen_cta_button"                 android:layout_width="wrap_content"                 android:layout_marginLeft="10dp"                 android:layout_height="30dp"                 android:layout_toRightOf="@+id/home_item_ad_desc"                 android:layout_marginTop="100dp"                 android:text="INSTALL"                 android:gravity="center"                 android:ellipsize="end"                 android:lines="1"                 android:textColor="#FFF"                 android:maxLines="1"                 android:textSize="18sp"                 />         </RelativeLayout>     </FrameLayout> </com.google.android.gms.ads.nativead.NativeAdView>` 

MainActivity.kt

`class MainActivity : FlutterActivity(){     private val CHANNEL = "verified.cv/channel" //The channel name you set in your main.dart file     override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {         super.configureFlutterEngine(flutterEngine)         MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {             // Note: this method is invoked on the main thread.             call, result ->             if (call.method == "createNotificationChannel") {                 val argData = call.arguments as java.util.HashMap<String, String>                 val completed = createNotificationChannel(argData)                 if (completed == true) {                     result.success(completed)                 } else {                     result.error("Error Code", "Error Message", null)                 }             } else {                 result.notImplemented()             }         }         GoogleMobileAdsPlugin.registerNativeAdFactory(                 flutterEngine, "listTile", ListTileNativeAdFactory(context))         GoogleMobileAdsPlugin.registerNativeAdFactory(                 flutterEngine, "skillCard", SkillCardNativeFactory(context))         GoogleMobileAdsPlugin.registerNativeAdFactory(                 flutterEngine, "homeScreen", HomeScreenNativeAd(context))         GoogleMobileAdsPlugin.registerNativeAdFactory(                 flutterEngine, "feedItem", FeedItemNativeFactory(context))     }     override fun cleanUpFlutterEngine(flutterEngine: FlutterEngine) {         super.cleanUpFlutterEngine(flutterEngine)         // TODO: Unregister the ListTileNativeAdFactory         GoogleMobileAdsPlugin.unregisterNativeAdFactory(flutterEngine, "listTile")         GoogleMobileAdsPlugin.unregisterNativeAdFactory(flutterEngine, "skillCard")         GoogleMobileAdsPlugin.unregisterNativeAdFactory(flutterEngine, "homeScreen")         GoogleMobileAdsPlugin.unregisterNativeAdFactory(flutterEngine, "feedItem")     }     private fun createNotificationChannel(mapData: HashMap<String, String>): Boolean {         val completed: Boolean         if (VERSION.SDK_INT >= VERSION_CODES.O) {             // Create the NotificationChannel             val id = mapData["id"]             val name = mapData["name"]             val descriptionText = mapData["description"]             // val sound = "your_sweet_sound"             val importance = NotificationManager.IMPORTANCE_HIGH             val mChannel = NotificationChannel(id, name, importance)             mChannel.description = descriptionText             // val soundUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + getApplicationContext().getPackageName() + "/raw/your_sweet_sound");             // val att = AudioAttributes.Builder()             //         .setUsage(AudioAttributes.USAGE_NOTIFICATION)             //         .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)             //         .build();             //mChannel.setSound(soundUri, att)             // Register the channel with the system; you can't change the importance             // or other notification behaviors after this             val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager             notificationManager.createNotificationChannel(mChannel)             completed = true         } else {             completed = false         }         return completed     } } ` 
 I/flutter ( 1409): ----------------FIREBASE CRASHLYTICS---------------- I/flutter ( 1409): PlatformException(NativeAdError, Can't find NativeAdFactory with id: homeScreen, null, null) I/flutter ( 1409): #0      StandardMethodCodec.decodeEnvelope package:flutter/…/services/message_codecs.dart:607 I/flutter ( 1409): #1      MethodChannel._invokeMethod package:flutter/…/services/platform_channel.dart:177 I/flutter ( 1409): <asynchronous suspension> I/flutter ( 1409): #2      NativeAd.load package:google_mobile_ads/src/ad_containers.dart:1033 I/flutter ( 1409): <asynchronous suspension> I/flutter ( 1409): ---------------------------------------------------- D/ACodec  ( 1409): dataspace changed to 0x10c40000 (R:2(Limited), P:4(BT601_6_525), M:3(BT601_6), T:3(SMPTE170M)) (

I'm using the following lines of code (PHP) after successfuly retriving the media URL and then storing it in the $mediaURL variable for the file request, but it's returning an empty string. Already tried with postman and it returns a 500 internal server error...

** Edited **

self::writeLog('Media URL: '.$mediaURL); self::writeLog('Preparing to download media - id: '.$media_id); $curl = curl_init($mediaURL); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $headers = array(     "Authorization: Bearer ".self::$auth_token, ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); if (($resp = curl_exec($curl)) === false) {     self::writeLog('cURL Error: '.curl_error($curl)); } else if ($resp == '') {     self::writeLog('Empty string.');     self::writeLog('URL: '.$mediaURL);     self::writeLog('Headers: '.$headers[0]); } else {     self::writeLog($resp); }              
  • writeLog is just a method that I use to write these messages on a txt file.

Hi I want to use WhatsApp business API in my web application. I have tested it in postman.

Whenever run sample curl code when available in Facebook business page under WhatsApp tab, It run successfully with temporary access token and message delivered to recipient with Facebook saved template. But when I send only text message to recipient then API response become success with message Id but message not yet deliver to recipient.

My curl code sample given bellow

curl --location --request POST 'https://graph.facebook.com/v13.0/106433498743301/messages' \ --header 'Authorization: Bearer EAAOw8oNtvXkBAKk89CqJtyusjxk7c7qGSNS0quxqeZBRtjE5MYwZCK0USeGGLV4n56qNAuaRoRWZA2oCIS8zcz6U5UZAtQCOb6YQnjuXZBfLnyZAwsOZBpASpnNOvvz29T0Jn0aXgZAdo9VKmBv0CkNYuOeb1I7X0GZCEwLHPZBFpfOCj4K3S9CMPjBfYR5Jog06LC95P7UgCr5Fy2nqbRM5Ys' \ --header 'Content-Type: application/json' \ --data-raw '{ "messaging_product": "whatsapp", "preview_url": false, "recipient_type": "individual", "to": "xxxxxxx150", "type": "text", "text": { "body": "Test message" } }'