Skip to content

Instantly share code, notes, and snippets.

@sud0n1m
Created September 11, 2012 00:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sud0n1m/3695125 to your computer and use it in GitHub Desktop.
Save sud0n1m/3695125 to your computer and use it in GitHub Desktop.
Caddy -> Pump data into Customer.io from CSV
#!/bin/bash
echo "Caddy v 0.1 from Customer.io"
ENDPOINT="https://app.customer.io/api/v1/customers/"
SITEID="YOUR SITE ID"
APIKEY="YOUR API KEY"
INPUT=users.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read id email created_at first last
do
curl -i $ENDPOINT$id \
-X PUT \
-u $SITEID:$APIKEY \
-d created_at=$created_at\
-d email=$email \
-d first=$first \
-d last=$last
done < $INPUT
IFS=$OLDIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment