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
- Java
- Node.js
client.providers().configure(
"EMAIL",
"SENDGRID",
Map.of(
"apiKey", System.getenv("SENDGRID_API_KEY"),
"fromAddress", "no-reply@yourapp.com"
)
);
await client.providers().configure('EMAIL', 'SENDGRID', {
apiKey: process.env.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.
- Java
- Node.js
var result = client.providers().testConnection("EMAIL", Map.of(
"apiKey", System.getenv("SENDGRID_API_KEY"),
"fromAddress", "no-reply@yourapp.com"
));
const result = await client.providers().testConnection('EMAIL', {
apiKey: process.env.SENDGRID_API_KEY!,
fromAddress: 'no-reply@yourapp.com',
});
Update or remove a provider
- Java
- Node.js
client.providers().update("EMAIL", "SENDGRID", Map.of("fromAddress", "hello@yourapp.com"));
client.providers().delete("EMAIL");
await client.providers().update('EMAIL', 'SENDGRID', { fromAddress: 'hello@yourapp.com' });
await client.providers().delete('EMAIL');
List configured providers
- Java
- Node.js
var providers = client.providers().list();
const providers = await client.providers().list();
Related
- Notifications — the channels a provider ultimately backs
- Java
ProviderApiClientreference - Node.js
ProviderApiClientreference