klaviyo / klaviyo-api-php

PHP SDK for Klaviyo API
https://developers.klaviyo.com
MIT License
46 stars 21 forks source link

Create a new profile using php sdk not working #53

Closed shubham-ids closed 5 months ago

shubham-ids commented 5 months ago
  1. Can we find profile with custom filter in the klaviyo site and send bulk email? Example: find those profiles whose plan is expired or who's renewed the plan.

  2. I have connected klaviyo php sdk with codeigniter successfully. I have getting the profile data by id. But when I add new profile with SDK example, I'm not facing an error on my site but no data added in profile lists using this approach. Can you help me to resolve this issue?

<?php
use KlaviyoAPI\KlaviyoAPI;
$klaviyoAPI = new KlaviyoAPI( KALVIYO_PRIVATE_KEY );
$klaviyoAPI->Profiles->createProfile([
                "data" => [
                    "type" => "profile",
                    "attributes" => [
                        'email' => 'test@test.com',
                        'first_name' => 'John',
                        'last_name' => 'Doe',
                        'phone_number' => '004300005400',
                        "external_id"=>"63f64a2b-c6bf-40c7-b81f-bed08162edbe",
                        'organization' => 'Example Corporation',
                        'title' => 'Regional Manager',
                        'image' => '',
                        'location' => [
                            "address1"=>"Test",
                            "address2"=>"Test1",
                            "city"=>"New York",
                            "country"=>"United States",
                            "region"=>"NY",
                            "zip"=>"00000",
                            "timezone"=>"America/New_York",
                            "ip"=>"127.0.0.1"
                        ],
                        'properties' => [],
                    ],
                ],
            ]);

Url: https://github.com/klaviyo/klaviyo-api-php image image

shubham-ids commented 5 months ago

I have resolve this issue.

         [
                "data" => [
                    "type" => "profile",
                    "attributes" => [
                        'email' => $userData->email,
                        'first_name' => $userData->name,
                        "external_id"=> $userData->user_id,
                    ],
                ],
            ]