Communication Integrations

Connect Hablr with email, SMS, and voice providers to enable multi-channel communication with your contacts. We support Resend, SendGrid, Twilio, and custom integrations.

Prerequisites

Before setting up communication integrations, ensure you have:

  • A Hablr account with admin or coordinator role
  • API keys from your chosen email/SMS provider
  • Verified sending domain (for email) or phone number (for SMS)
  • DNS access for domain verification (SPF, DKIM, DMARC)

Email Integration

Choose from our supported email providers for transactional and marketing emails:

Resend

Recommended

Modern email API with excellent deliverability. Recommended for production use.

  • High deliverability
  • React email templates
  • Webhook events
  • Analytics

SendGrid

Enterprise-grade email delivery with advanced analytics and marketing features.

  • Transactional email
  • Marketing campaigns
  • Email validation
  • Detailed analytics

Custom SMTP

Connect any SMTP server for email delivery. Best for development or self-hosted setups.

  • Any SMTP server
  • Full control
  • Development testing
  • Self-hosted option
Resend Configuration
// Environment variable
RESEND_API_KEY=re_xxxxxxxxxxxx

// Sending an email with Resend
import { Resend } from "resend";

const resend = new Resend(process.env.RESEND_API_KEY);

await resend.emails.send({
  from: "Hablr <notifications@yourdomain.com>",
  to: ["recipient@example.com"],
  subject: "Welcome to Hablr",
  html: "<p>Thank you for signing up!</p>",
});
SendGrid Configuration
// Environment variable
SENDGRID_API_KEY=SG.xxxxxxxxxxxx

// Sending an email with SendGrid
import sgMail from "@sendgrid/mail";

sgMail.setApiKey(process.env.SENDGRID_API_KEY);

await sgMail.send({
  to: "recipient@example.com",
  from: "notifications@yourdomain.com",
  subject: "Welcome to Hablr",
  html: "<p>Thank you for signing up!</p>",
});

SMS & Voice Integration

Enable SMS messaging and voice calls for direct communication:

Twilio

Industry-leading SMS and voice platform with global reach and programmable communications.

  • SMS messaging
  • Voice calls
  • WhatsApp
  • Global coverage

Custom Provider

Integrate with any SMS/voice provider using webhooks and REST APIs.

  • Webhook integration
  • REST API
  • Custom routing
  • Flexible setup
Twilio SMS Configuration
// Environment variables
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_PHONE_NUMBER=+1234567890

// Sending an SMS with Twilio
import twilio from "twilio";

const client = twilio(
  process.env.TWILIO_ACCOUNT_SID,
  process.env.TWILIO_AUTH_TOKEN
);

await client.messages.create({
  body: "Hello from Hablr! Your appointment is confirmed.",
  from: process.env.TWILIO_PHONE_NUMBER,
  to: "+1987654321", // E.164 format
});
Twilio Voice Call
// Making a voice call with Twilio
await client.calls.create({
  url: "https://hablr.co/api/twilio/voice-response",
  to: "+1987654321",
  from: process.env.TWILIO_PHONE_NUMBER,
});

// TwiML response endpoint
export async function POST() {
  const twiml = `
    <Response>
      <Say voice="alice">
        Hello! This is a reminder from Hablr about your upcoming appointment.
      </Say>
    </Response>
  `;
  
  return new Response(twiml, {
    headers: { "Content-Type": "text/xml" },
  });
}

Configuration Steps

Follow these steps to configure your communication integrations:

  1. Choose your providers

    Select email and SMS/voice providers based on your needs and budget.

  2. Create provider accounts

    Sign up for Resend, SendGrid, Twilio, or your preferred providers.

  3. Verify your domain

    Add DNS records for SPF, DKIM, and DMARC to improve deliverability.

  4. Configure API keys in Hablr

    Go to Settings → Integrations and enter your API credentials.

  5. Set up webhook endpoints

    Configure webhooks to receive delivery status and engagement events.

  6. Test your configuration

    Send test messages to verify everything is working correctly.

Webhook Event Handler
// Handle email delivery webhooks
export async function POST(request: Request) {
  const payload = await request.json();
  
  switch (payload.type) {
    case "email.delivered":
      await updateMessageStatus(payload.messageId, "delivered");
      break;
    case "email.opened":
      await trackEngagement(payload.messageId, "opened");
      break;
    case "email.bounced":
      await handleBounce(payload.email, payload.bounceType);
      break;
    case "sms.delivered":
      await updateSMSStatus(payload.messageSid, "delivered");
      break;
  }
  
  return new Response("OK", { status: 200 });
}

Troubleshooting

Common issues and their solutions:

Emails going to spam

Verify your domain with SPF, DKIM, and DMARC records. Use a dedicated sending domain and warm up your IP address gradually.

SMS not delivered

Check that the phone number is in E.164 format (+1XXXXXXXXXX). Verify your Twilio account has sufficient balance and the number is not on a blocklist.

Webhook events not received

Ensure your webhook endpoint is publicly accessible and returns a 200 status within 5 seconds. Check firewall rules and SSL certificate validity.

Rate limit exceeded

Implement exponential backoff for retries. Consider upgrading your plan or spreading sends over time using queues.

Next Steps