AI Smart Routing
Let AI automatically pick the best channel for each recipient based on their engagement history.
AI Smart Routing must be enabled for your organization. If it's turned off, channel: "auto" still works — YourSend picks email or SMS based on the recipient address format.
Overview
Instead of specifying email, sms, or voice, set channel: "auto"and YourSend's AI will analyze recipient engagement data to pick the channel most likely to get a response.
Usage
smart-send.ts
import { YourSend } from 'yoursend';
const ys = new YourSend({ apiKey: 'ys_live_...' });
// AI picks the best channel for this recipient
await ys.send({
channel: 'auto',
to: 'user@example.com', // email OR E.164 phone — AI routes by this address
subject: 'Your order shipped', // used if email is chosen
html: '<p>Your order has shipped!</p>',
body: 'Your order has shipped! Track: https://track.example.com/1234', // used for SMS/voice
fallback: 'sms', // optional: channel to try if the chosen one fails
fallback_to: '+14155551234', // optional: address for the fallback channel
});How It Works
- Contact lookup — YourSend checks the recipient's engagement history (open rates, click rates, response rates per channel).
- AI scoring — Each channel is scored based on historical engagement, time of day, and message type.
- Channel selection — The highest-scoring channel is selected and the message is sent.
- Fallback — If the selected channel fails (e.g., invalid phone number), YourSend automatically falls back to the next best channel.