Introduzione
Attiva campagne email personalizzate e percorsi cliente basati su eventi di pagamento. Invia automaticamente email di benvenuto per nuovi clienti, aggiornamenti di abbonamento e notifiche di errore di pagamento tramite Customer.io.
Questa integrazione richiede il tuo Site ID e API Key di Customer.io.
Iniziare
Open the Webhook Section
Nel tuo cruscotto Dodo Payments, vai su Webhooks → + Aggiungi endpoint ed espandi il menu a discesa delle integrazioni.
Select Customer.io
Seleziona la scheda di integrazione Customer.io .
Enter Credentials
Inserisci il tuo Site ID e API Key di Customer.io nella configurazione.
Configure Transformation
Modifica il codice di trasformazione per formattare gli eventi per l’API Track di Customer.io.
Test & Create
Testa con payload di esempio e clicca Crea per attivare la sincronizzazione.
Done!
🎉 Gli eventi di pagamento attiveranno ora le automazioni email di Customer.io.
Traccia Eventi di Pagamento
function handler ( webhook ) {
if ( webhook . eventType === "payment.succeeded" ) {
const p = webhook . payload . data ;
webhook . url = "https://track.customer.io/api/v2/entity" ;
webhook . payload = {
type: "person" ,
identifiers: {
id: p . customer . customer_id
},
action: "payment_completed" ,
name: "Payment Completed" ,
attributes: {
email: p . customer . email ,
name: p . customer . name ,
payment_amount: ( p . total_amount / 100 ). toFixed ( 2 ),
payment_method: p . payment_method || "unknown" ,
payment_id: p . payment_id ,
currency: p . currency || "USD"
}
};
}
return webhook ;
}
See all 23 lines
Traccia Ciclo di Vita dell’Abbonamento
function handler ( webhook ) {
const s = webhook . payload . data ;
switch ( webhook . eventType ) {
case "subscription.active" :
webhook . url = "https://track.customer.io/api/v2/entity" ;
webhook . payload = {
type: "person" ,
identifiers: {
id: s . customer . customer_id
},
action: "subscription_started" ,
name: "Subscription Started" ,
attributes: {
email: s . customer . email ,
subscription_id: s . subscription_id ,
product_id: s . product_id ,
amount: ( s . recurring_pre_tax_amount / 100 ). toFixed ( 2 ),
frequency: s . payment_frequency_interval ,
next_billing: s . next_billing_date
}
};
break ;
case "subscription.cancelled" :
webhook . url = "https://track.customer.io/api/v2/entity" ;
webhook . payload = {
type: "person" ,
identifiers: {
id: s . customer . customer_id
},
action: "subscription_cancelled" ,
name: "Subscription Cancelled" ,
attributes: {
email: s . customer . email ,
subscription_id: s . subscription_id ,
cancelled_at: s . cancelled_at ,
cancel_at_next_billing: s . cancel_at_next_billing_date
}
};
break ;
}
return webhook ;
}
See all 42 lines
Traccia Attributi del Cliente
function handler ( webhook ) {
if ( webhook . eventType === "payment.succeeded" ) {
const p = webhook . payload . data ;
webhook . url = "https://track.customer.io/api/v2/entity" ;
webhook . payload = {
type: "person" ,
identifiers: {
id: p . customer . customer_id
},
action: "identify" ,
name: "Customer Identified" ,
attributes: {
email: p . customer . email ,
name: p . customer . name ,
total_spent: ( p . total_amount / 100 ). toFixed ( 2 ),
payment_method: p . payment_method || "unknown" ,
last_payment_date: webhook . payload . timestamp ,
customer_since: webhook . payload . timestamp
}
};
}
return webhook ;
}
See all 23 lines
Suggerimenti
Usa nomi di eventi coerenti che corrispondano alle tue campagne di Customer.io
Includi attributi rilevanti per la personalizzazione
Imposta identificatori cliente appropriati per un tracciamento accurato
Usa nomi di eventi significativi per i trigger delle campagne
Risoluzione dei Problemi
Events not triggering campaigns
Verifica che Site ID e API Key siano corretti
Controlla che i nomi degli eventi corrispondano alle campagne di Customer.io
Assicurati che gli identificatori dei clienti siano impostati correttamente
Revisiona i limiti di velocità dell’API di Customer.io