Skip to main content

phone number not supported in my account.

  • July 17, 2024
  • 1 reply
  • 405 views

Hi

 

I am trying to subscribe a new profile to a list but I get this error:

Array ( [errors] => Array ( [0] => Array ( [id] => 8647527d-59b1-49ed-a4ea-48582741d37b [status] => 400 [code] => invalid [title] => Invalid input. [detail] => Phone number is valid but is not in a supported region for this account. Please configure a sending number for this region. [source] => Array ( [pointer] => /data/attributes/profiles/data/0/attributes/phone_number ) [links] => Array ( ) [meta] => Array ( ) ) ) )

 

Here is the code:

 

<?php

/* Using Subscribe profiles to write a new profile - Testing */


$email ='second@ecovib2d.com.au';
$firstname ='Adrian';
$lastname  ='Mason';
$id = '';
$status = 'SUBSCRIBED';
$List_id = 'XXXXXXXXXXX'; // Master list

$data=array();
 

$data = [

"data"=> [
    "type"=> "profile-subscription-bulk-create-job",
    "attributes"=> [
      "custom_source"=> "Purchase Event",
      "profiles"=> [
        "data"=> [
          [
            "type"=> "profile",
            "id"=> $id,
            "attributes"=> [
              "email"=> $email,
              "phone_number" => "+610423029480",
              "subscriptions"=> [
                "email"=> [
                  "marketing"=> [
                    "consent"=> $status,
                  ]
                ],
                "sms"=> [
                  "marketing"=> [
                    "consent"=> $status,
                  ]
                ]
              ]
            ]
          ]
        ]
      ],
      "historical_import"=> false
    ],
    "relationships"=> [
      "list"=> [
        "data"=> [
          "type"=> "list",
          "id"=> $List_id,
        ]
      ]
    ]
  ]

]; 

 
        $curl = curl_init();
        curl_setopt_array($curl, array(
        CURLOPT_URL => 'https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs/',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => json_encode($data),
        CURLOPT_HTTPHEADER => array(
         'Authorization: Klaviyo-API-Key pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',  
         'accept: application/json' ,
         'content-type: application/json',
         'revision: 2024-07-15',
         
        ),
    ));

$created_profile = curl_exec($curl);

print_r(json_decode($created_profile,true));

if ($created_profile === false) {
    $error = curl_error($curl);
    curl_close($curl);
    die('Curl error: ' . $error);
}
    
curl_close($curl);

    
?>    
    
    

     

1 reply

Kim Strauch
Klaviyo Employee
Forum|alt.badge.img+9
  • Klaviyo Employee
  • July 18, 2024

@Tudsy, the error message states that you don’t have a sending number configured on your account for the region of the phone # you’re trying to subscribe.

It looks like you are trying to subscribe an Australian phone number. If you don’t have an Australian sending number active on the account, you are unable to grant SMS consent for this phone #. 

If you want to include the phone # on the profile but not mark it as consented, you can remove     "sms"=> [
                  "marketing"=> [
                    "consent"=> $status,
                  ]
                ]

from your request payload