Skip to main content

API Credentials

uses a key pair: Public Key and Secret Key. Both are generated in the Security menu of the dashboard: Security.

Public Key

The Public Key is used by the channel connection SDK (@hubmessage/connect). With it, you can connect channels directly within your system, without needing to access the dashboard.
The Public Key can be exposed in your application’s frontend, as it has limited permissions for channel connection only.
Example usage:
import HubMessage from '@hubmessage/connect';

const client = HubMessage.newClient({
  publicKey: 'YOUR_PUBLIC_KEY'
});

Secret Key

The Secret Key is used for authentication in all APIs. It must be sent in the Authorization header as a Bearer token in every request.
The Secret Key must never be exposed in the frontend. Use it only in your application’s backend.
Example usage:
curl -X GET https://api.hubmessage.io/whatsapp/businesses \
  -H "Authorization: Bearer YOUR_SECRET_KEY"

Summary

KeyUsageWhere to useCan expose in frontend?
Public KeyChannel connection SDKFrontend or backendYes
Secret KeyAll API calls (channels, templates, messages)Backend onlyNo

Next steps

Create a channel

Create your first channel to start sending messages.

Connect channel via SDK

Integrate the connection flow into your system.