Skip to main content

Providers

A provider is the underlying credential set NotificationHub uses to actually dispatch a channel — for example, an SMTP or email API provider behind the EMAIL channel, or an SMS gateway behind SMS. Provider operations live under client.providers() and take a channelType string (e.g. "EMAIL", "SMS", "PUSH", "WEBHOOK") plus a providerName and a free-form config map of credential fields.

Configure a provider

client.providers().configure(
"EMAIL",
"SENDGRID",
Map.of(
"apiKey", System.getenv("SENDGRID_API_KEY"),
"fromAddress", "no-reply@yourapp.com"
)
);

channelType and providerName are upper-cased by the SDK before the request is sent, so "email" and "EMAIL" are equivalent.

Test a provider connection

Validate credentials before saving them, or diagnose a provider that's failing in production.

var result = client.providers().testConnection("EMAIL", Map.of(
"apiKey", System.getenv("SENDGRID_API_KEY"),
"fromAddress", "no-reply@yourapp.com"
));

Update or remove a provider

client.providers().update("EMAIL", "SENDGRID", Map.of("fromAddress", "hello@yourapp.com"));
client.providers().delete("EMAIL");

List configured providers

var providers = client.providers().list();