Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to import people in bulk via CSV? #62

Open
Nicolas-Bouteille opened this issue Jul 10, 2023 · 1 comment
Open

Any way to import people in bulk via CSV? #62

Nicolas-Bouteille opened this issue Jul 10, 2023 · 1 comment

Comments

@Nicolas-Bouteille
Copy link

Nicolas-Bouteille commented Jul 10, 2023

Hello,
I would like to use the /v1/imports endpoint to send a CSV file to import people
https://customer.io/docs/api/app/#tag/Imports
It seems your implementation of the CustomerIO APP API does not provide this feature yet.
Am I right?
If so, is there a way to specify a custom endpoint while using your implementation?
Thank you
Nicolas

@Nicolas-Bouteille
Copy link
Author

OK I figured out how I could do it:
I've seen that I could not call directly Client::request() because it is protected, but I could call Client::post()
I just needed to override the API endpoint so that my post request does not use the default Track API but the App API instead. I saw this could be done by specifying a custom 'endpoint' in the json parameter.
Also, the $endpoint parameter of the post method must not be the whole url such as "https://api.customer.io/v1/imports", but only the path "imports"

Here is the code:

$data = [
"endpoint" => "https://api.customer.io/v1/",
"import" => [
"name" => "The name displayed in Customer's UI in the list of all your imports",
"data_file_url" => "https://YOUR-SITE.com/YOUR-PUBLIC-PATH/export-users.csv",
"type" => "people",
"identifier" => "id",
"people_to_process" => "all",
"description" => "The description displayed in Customer's UI in the list of all your imports"
]
];

$response = $this->cio_client->post('imports', $data);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant