Skip to content
v2.7

Your own provider

Use your own SMTP, Mailgun, SendGrid, Resend, Amazon SES, Twilio, Vonage, Msg91, Telesign, Textmagic, FCM, or APNS account to deliver messages.

With your own provider, messages go out through your account, with its quota, reputation, and cost. In the console: Messaging → Providers → New provider, choose the service, and enter the credentials.

Channel Services
Email SMTP, Mailgun, SendGrid, Resend, Amazon SES
SMS Twilio, Vonage, Msg91, Telesign, Textmagic
Push FCM, APNS (see Push)

Only one provider stays enabled per channel for email and SMS (for push, several can stay enabled, such as one FCM and one APNS). With two email providers enabled, sending would use either one, in no particular order. That’s why the console creates the second provider disabled and, when you enable one, disables the others on the same channel (asking for confirmation).

Enter the server, the port, the username, the password, the encryption (STARTTLS on 587 or SSL on 465), and the sender. The server must be public. These cases are refused on create and on edit, with the error owbase_smtp_host_invalid (400) and a message saying what to fix. The server returns these messages in Portuguese, so they appear below as they come, followed by their meaning:

Case Message
Port 25 A porta 25 não é aceita no servidor SMTP do projeto. Use a 587 (STARTTLS) ou a 465 (SSL). — Port 25 isn’t accepted on the project’s SMTP server. Use 587 (STARTTLS) or 465 (SSL).
Private, local, or reserved IP O servidor SMTP não pode ser um endereço IP privado, local ou reservado. Use o nome público do servidor ou um IP público. — The SMTP server can’t be a private, local, or reserved IP address. Use the server’s public name or a public IP.
Name without a dot, localhost, .local, .internal O servidor SMTP precisa ser um nome público completo (como smtp.exemplo.com); nomes locais, sem ponto ou terminados em .local ou .internal não são aceitos. — The SMTP server must be a full public name (like smtp.example.com); local names, names without a dot, or names ending in .local or .internal aren’t accepted.
Name that points to a private address O nome do servidor SMTP aponta para um endereço privado, local ou reservado. Use um servidor SMTP público. — The SMTP server name points to a private, local, or reserved address. Use a public SMTP server.
Name that doesn’t resolve Não foi possível resolver o nome do servidor SMTP. Confira o endereço e tente de novo. — Couldn’t resolve the SMTP server name. Check the address and try again.
Server with :port, ;, or / Endereço do servidor SMTP inválido: use o nome do servidor (como smtp.exemplo.com) ou um IP público. — Invalid SMTP server address: use the server name (like smtp.example.com) or a public IP.

On Amazon SES, the region must be an AWS code, such as us-east-1 or sa-east-1 (owbase_messaging_provider_invalid).

mensagens-provedor.ts (server)
import { ID, Messaging, OwbaseException, SmtpEncryption } from '@owbase/node';
import { client } from './client';
// The key needs the providers.write scope (and providers.read to list).
const messaging = new Messaging(client);
// SMTP from your email provider: port 587 with STARTTLS. The password comes from the server environment, never from the code.
const smtp = await messaging.createSMTPProvider({
providerId: ID.unique(),
name: 'Shop SMTP',
host: 'smtp.myshop.com',
port: 587,
username: '[email protected]',
password: process.env.SMTP_PASSWORD ?? '',
encryption: SmtpEncryption.Tls,
fromName: 'My Shop',
fromEmail: '[email protected]',
enabled: true,
});
// Credentials never come back through the API: credentials is always empty ({}).
console.log(smtp.$id, smtp.enabled, smtp.credentials);
try {
// Port 25, private IPs and names without a domain are refused before reaching the server.
await messaging.createSMTPProvider({ providerId: ID.unique(), name: 'Test', host: 'smtp.myshop.com', port: 25 });
} catch (e) {
// 400 owbase_smtp_host_invalid: the message says what to fix.
if (e instanceof OwbaseException) console.log(e.code, e.type, e.message);
}

Credentials are stored on the server and never come back through the API: in every provider response (list, read, create, update) the credentials field comes back empty ({}). The console shows “Credentials: configured”. To change a credential, edit the provider and enter the new value; an empty field keeps what is saved.

Provider webhook events (providers.*) carry the provider as it was saved, credentials included, to the project’s own webhook. If one of your webhooks listens to these events, treat the body as a secret.

  • The openwave ID is reserved for Openwave email (owbase_messaging_provider_reserved).
  • Your own push over MQTT isn’t available (owbase_messaging_provider_unavailable, 403).
Was this page helpful?