Getting started with the Olly Messenger API.
Before using the API you must obtain your account's API Key manually by contacting us at [email protected].
You can send a message by using the content field, or an attachment by including the url field pointing to a publicly accessible file URL.
interface ProviderOutgoingMessage {
provider_number: string; // Which sender number to use
number: string; // e.g. '+16207809306' or '[email protected]'
group_id?: string; // Reply to a specific group
content?: string;
url?: string;
}
Example
curl -X POST https://messenger.olly.bot/api/message \
-H "Content-Type: application/json" \
-H "Authorization: Basic <api-key>" \
-d '{
"number": "+16208039306",
"content": "hello world",
"provider_number": "+12020304444"
}'
Starts the typing indicator to the specified contact. The indicator stops once an outbound message is sent, or after 30 seconds.
interface ProviderTypingIndicator {
number: string; // e.g. '+16207809306' or '[email protected]'
provider_number: string; // Which sender number to use
}
Example
curl -X POST https://messenger.olly.bot/api/typing/start \
-H "Content-Type: application/json" \
-H "Authorization: Basic <api-key>" \
-d '{"number": "+16208039306"}'
Set the publicly accessible URL that will receive notifications of incoming messages and outgoing message statuses.
Endpointinterface AccountWebhookUpdateRequest {
url: string;
}
Example
curl -X POST https://messenger.olly.bot/api/webhook \
-H "Content-Type: application/json" \
-H "Authorization: Basic <api-key>" \
-d '{"url": "https://example.com/my-webhook"}'
The payloads below will be forwarded to the webhook configured for your account. Match the type field to listen for specific events.
guid to avoid responding to the same message twice.Provides status updates on sent messages. Some non-terminal statuses may be skipped if the message has already reached a terminal state.
Payloadinterface ProviderMessageUpdate {
type: "OutgoingMessageStatus";
guid: string;
number: string;
group_id: string | null;
provider_number: string;
error: number;
status: MessageStatus;
service: "SMS" | "iMessage";
}
enum MessageStatus {
QUEUED = "QUEUED", // Non-terminal
SENT = "SENT", // Non-terminal
DECLINED = "DECLINED",
RECEIVED = "RECEIVED",
DELIVERED = "DELIVERED",
ERROR = "ERROR",
UNKNOWN = "UNKNOWN",
}
Notifies when one of the account's numbers has received a message.
Payloadinterface ProviderIncomingMessage {
type: "IncomingMessage";
guid: string;
number: string;
content: string;
group_id: string | null;
provider_number: string;
service: "SMS" | "iMessage";
}
Notifies when an attachment is received. Attachments may include a corresponding message in content.
interface ProviderIncomingAttachment {
type: "IncomingAttachment";
guid: string;
number: string;
content: string;
group_id: string | null;
provider_number: string;
url: string; // Full path to download attachment
extension: string;
filename: string;
transfer_name: string;
mime_type: string;
total_bytes: number;
is_sticker: number;
service: "SMS" | "iMessage";
}