Download the PHP package sendimessage/sdk without Composer
On this page you can find all versions of the php package sendimessage/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sendimessage/sdk
More information about sendimessage/sdk
Files in sendimessage/sdk
Package sdk
Short Description SendiMessage SDK — send iMessage/SMS through the SendiMessage API
License MIT
Homepage https://sendimessage.com
Informations about the package sdk
SendiMessage SDK for PHP
The official PHP client for the SendiMessage API —
send and receive iMessage and SMS programmatically. No dependencies
beyond ext-curl and ext-json.
Server-side only. The API key pair grants full messaging access to your account — never expose it in front-end code.
Contents
- Requirements
- Installation
- Authentication
- Quick start
- Usage
- Sending messages
- Sending media
- Scheduling and status callbacks
- Message status and history
- iMessage lookup
- Contacts and opt-out
- Lines and call forwarding
- Conversations
- Webhooks
- Error handling
- Configuration
- API reference
- License
Requirements
- PHP ≥ 8.1 with
ext-curlandext-json - A SendiMessage account with an API key pair
Installation
Authentication
Create a key pair in the account portal
under API credentials. You get a key_id and a secret — the secret is
shown once, store it securely (e.g. in your secret manager or environment
variables). Every request the SDK makes carries them as the X-API-Key /
X-API-Secret headers.
You can verify a key pair at any time with GET /me (curl example in the
account portal).
Quick start
The API delivers over iMessage first and falls back to SMS when the recipient is not reachable over iMessage.
Usage
Sending messages
If your account has more than one line (sending number), route via a specific
one with lineHandle:
Sending media
Upload the file first — uploadMedia returns a public URL you pass as
mediaUrl. Images, video, audio and PDF are supported, up to 50 MiB.
content is optional when mediaUrl is set; provide both to send a caption
with the attachment. Any public http(s) URL also works as mediaUrl.
Scheduling and status callbacks
Message status and history
Every send returns a message_handle. Poll it — or better, use a
webhook / statusCallback:
History is cursor-paginated: pass next_before from one page as before on
the next. next_before is null on the last page.
Filters: number, direction (in / out), line_handle,
conversation_handle, service, since, until, limit.
iMessage lookup
Check whether a number is reachable over iMessage before sending:
Lookups are answered by a live Apple device, so the API is cache-first: a
fresh cached answer returns immediately, otherwise the question is queued and
the call waits briefly for a device. If no answer arrives in time you get a
pending response — retry shortly; a 503 means no device is currently
online for your account.
Contacts and opt-out
Contacts are your address book: names shown in conversations, the detected service (iMessage/SMS) and the opt-out flag.
Opt-out is enforced on every send path — a send to an opted-out number
fails with HTTP 422. Inbound STOP / UNSUBSCRIBE / CANCEL / END /
QUIT opts the sender out automatically; START / UNSTOP / YES opts
back in. You can also manage it explicitly:
Lines and call forwarding
A line is a sending identity (phone number or iMessage address) on your account.
Calls to your line's number can be forwarded to any number you choose.
Forwarding is configured by the SendiMessage operator, so changes are
asynchronous — the API answers 202 and the request shows as pending until
fulfilled:
Conversations
Conversations group the message history per contact:
Webhooks
Get pushed events instead of polling. Events:
| Event | Fired when |
|---|---|
receive |
An inbound message arrives |
outbound |
An outbound message reaches its final status (sent/failed) |
line_blocked |
A line was blocked by Apple (sends answer 422 until unblocked) |
line_unblocked |
The block was lifted |
When the webhook has a secret, every delivery carries an
X-SMSBridge-Signature header — the hex HMAC-SHA256 of the raw request
body. Always verify it:
Error handling
Every non-2xx response throws SendImessage\ApiException with the HTTP code
as getCode(), the API error text as getMessage(), and the parsed response
body on the body property.
Common statuses:
| Status | Meaning |
|---|---|
401 |
Bad or missing key pair |
404 |
Unknown handle (message, contact, line, conversation) |
422 |
Validation failed — including sends to an opted-out contact or via a blocked line |
429 |
Rate limited — back off and retry |
503 |
Lookup: no device online for your account |
Configuration
API reference
| Method | Endpoint |
|---|---|
sendMessage(number, content?, mediaUrl?, lineHandle?, statusCallback?, scheduledAt?) |
POST /send-message |
getStatus(messageHandle) |
GET /status |
listMessages(filters?) |
GET /v2/messages |
getMessage(messageHandle) |
GET /v2/messages/{handle} |
uploadMedia(path, filename?) |
POST /media |
lookup(number) |
GET /lookup |
listContacts(params?) |
GET /contacts |
createContact(props) |
POST /contacts |
getContact(number) |
GET /contacts/{number} |
updateContact(number, props) |
PUT /contacts/{number} |
deleteContact(number) |
DELETE /contacts/{number} |
setOptOut(number, optedOut?) |
POST /contacts/opt-out |
recheckContact(number) |
POST /contacts/{number}/lookup |
listLines() |
GET /lines |
updateLine(lineHandle, label?, isActive?) |
PUT /lines/{handle} |
getCallForwarding(lineHandle) |
GET /lines/{handle}/call-forwarding |
setCallForwarding(lineHandle, forwardingNumber) |
PUT /lines/{handle}/call-forwarding |
listConversations(params?) |
GET /conversations |
listConversationMessages(handle, params?) |
GET /conversations/{handle}/messages |
markConversationRead(handle) |
POST /conversations/{handle}/read |
listWebhooks() |
GET /account/webhooks |
createWebhook(url, events?, secret?) |
POST /account/webhooks |
replaceWebhooks(webhooks) |
PUT /account/webhooks |
deleteWebhook(url) |
DELETE /account/webhooks |
Full HTTP-level reference: the Postman collection.
License
MIT
Forcing SMS
By default the Mac tries iMessage and falls back to SMS when Apple reports the number has no iMessage. Pass service: 'sms' to send a plain text message straight away (or 'imessage' to insist on the default path):
$client->me() returns the user + company behind the key pair — the cheapest way to verify credentials.
All versions of sdk with dependencies
ext-curl Version *
ext-json Version *