Official Java SDK for the 1msg WhatsApp Business API.
This document is generated from the public OpenAPI contract. It covers install, auth, quick start, and every public operation available in the client.
| Maven Central | io.1msg:sdk |
| Source | github.com/1msg/1msg-sdk |
| API docs | docs.1msg.io |
| Platform | platform.1msg.io |
| Support | support@1msg.io |
| OpenAPI version | 1.0.0 |
| Operations | 60 |
| AI agent guide | AGENTS.md |
implementation("io.1msg:sdk:1.0.1")<dependency>
<groupId>io.1msg</groupId>
<artifactId>sdk</artifactId>
<version>1.0.1</version>
</dependency>| Variable | Where to get it | Example |
|---|---|---|
baseUrl |
Platform → channel → API host | https://api.1msg.io |
instanceId |
Platform → channel id | ODI371267300 |
token |
Platform → channel → API token | JWT or API key |
Use environment variables (MSG_API_TOKEN, MSG_INSTANCE_ID). Never commit tokens.
import io.onemsg.sdk.ApiClient;
import io.onemsg.sdk.Configuration;
import io.onemsg.sdk.api.MessagingApi;
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.1msg.io/" + System.getenv("MSG_INSTANCE_ID"));
MessagingApi messaging = new MessagingApi(client);
messaging.sendMessage(
System.getenv("MSG_API_TOKEN"),
"Hello from 1MSG SDK",
null,
"12020721369@c.us",
null
);All requests use query-token auth:
https://{baseUrl}/{instanceId}/{path}?token={token}
Pass the channel token as the first argument to generated API methods.
chatId:12020721369@c.us(1:1) or...@g.us(group)phone: country code + number, no+- Exactly one of
chatId|phoneper request
Free-form sendMessage only works inside the 24h customer-care window.
Outside that window use sendTemplate.
MessagingApi // send/list messages, media, interactive
ProfileApi // getMe
GroupsApi // create/list/manage groups
FlowsApi // WhatsApp Flows lifecycle
TemplatesApi // listTemplates
ChannelApi // channel helpers
CallingApi // calling
WebhooksApi // webhooksMaven coordinates are io.1msg:sdk. Java packages live under io.onemsg.sdk because io.1msg is not a valid Java package segment.
API groups: calling, catalog, channel, flows, groups, messaging, profile, templates, users, webhooks.
Get calling settings
WhatsApp Calling API settings (beta). Requires Meta Calling enablement on the WABA. Not production-complete — paths and webhook field names may change. Trial/subscription-limited channels are blocked.
http: GET /callingSettings
operationId: getCallingSettings
clientGroup: calling
responses: 200, 401, 500Initiate WhatsApp call
Outbound Calling API (beta). Requires Meta Calling enablement and product consent. Not production-complete — verify on stage before relying on this in production. Trial/subscription-limited channels are blocked.
http: POST /initiateCall
operationId: initiateCall
clientGroup: calling
responses: 200, 401, 500Update calling settings
Update WhatsApp Calling API settings (beta). Requires Meta Calling enablement. Trial/subscription-limited channels are blocked.
http: POST /callingSettings
operationId: updateCallingSettings
clientGroup: calling
responses: 200, 401, 500Set Commerce Settings
Update catalog/cart commerce settings via the params object. - params.is_catalog_visible — show catalog storefront icon (true) or hide it (false). - params.is_cart_enabled — enable cart (true) or disable it (false). Blocked when the channel subscription limit is exceeded. Requires a commerce-capable channel (Cloud Functions /commerceWAV2).
http: POST /commerce
operationId: createCommerce
clientGroup: catalog
responses: 200, 401, 500Get Commerce Settings
Returns catalog/cart commerce settings for the channel. - is_catalog_visible — show catalog storefront icon (true) or hide it (false). - is_cart_enabled — enable cart (true) or disable it (false).
http: GET /commerce
operationId: getCommerce
clientGroup: catalog
responses: 200, 401, 500Get conversational automation settings
Get WhatsApp conversational components for the channel (welcome message, ice-breaker prompts, and slash commands). Proxies Meta/360dialog GET /conversational_automation. When enable_welcome_message is true and a user opens chat for the first time, Meta delivers a webhook message with type: request_welcome. The inbound formatter exposes that as type: "request_welcome" and meta.request_welcome: true so your webhook can send a custom welcome reply.
http: GET /conversationalAutomation
operationId: getConversationalAutomation
clientGroup: channel
responses: 200, 401, 500Get channel status
Returns WhatsApp Business API client connection status.
http: GET /status
operationId: getStatus
clientGroup: channel
responses: 200, 401, 500Set conversational automation settings
Update WhatsApp conversational components. Allowed body fields (others are ignored): - enable_welcome_message (boolean) - prompts (string[], max 4, each ≤ 80 chars) - commands ({ command_name, command_description }[]) Proxies Meta/360dialog POST /conversational_automation.
http: POST /conversationalAutomation
operationId: setConversationalAutomation
clientGroup: channel
responses: 200, 401, 500Create Flow
http: POST /flows
operationId: createFlows
clientGroup: flows
responses: 200Deprecate Flow
http: POST /flows/{flowId}/deprecate
operationId: createFlowsFlowIdDeprecate
clientGroup: flows
responses: 200Publish Flow
http: POST /flows/{flowId}/publish
operationId: createFlowsFlowIdPublish
clientGroup: flows
responses: 200Delete Flow
http: DELETE /flows/{flowId}
operationId: deleteFlowsFlowId
clientGroup: flows
responses: 200Get Flow Details
http: GET /flows/{flowId}
operationId: getFlowsFlowId
clientGroup: flows
responses: 200Preview Flow
http: GET /flows/{flowId}/preview
operationId: getFlowsFlowIdPreview
clientGroup: flows
responses: 200Get business encryption public key
Retrieve the WhatsApp business public key and signature status for this channel's phone number. Required before publishing or sending Flows that use data encryption.
http: GET /whatsapp_business_encryption
operationId: getWhatsappBusinessEncryption
clientGroup: flows
responses: 200, 401, 500List Flows
http: GET /flows
operationId: listFlows
clientGroup: flows
responses: 200Update Flow Structure
http: PATCH /flows/{flowId}/assets
operationId: patchFlowsFlowIdAssets
clientGroup: flows
responses: 200Update Flow Metadata
http: PATCH /flows/{flowId}/metadata
operationId: patchFlowsFlowIdMetadata
clientGroup: flows
responses: 200Set business encryption public key
Upload and sign a 2048-bit RSA business public key (PEM) for this channel's phone number. Meta requires a signed key before Flow publish/send. Only one active key per number; a new upload replaces the previous key.
http: POST /whatsapp_business_encryption
operationId: setWhatsappBusinessEncryption
clientGroup: flows
responses: 200, 400, 401, 500Create Group
http: POST /groups
operationId: createGroups
clientGroup: groups
responses: 200Update Group Info
http: POST /groups/{groupId}
operationId: createGroupsGroupId
clientGroup: groups
responses: 200Reset Invite Link
http: POST /groups/{groupId}/inviteLink
operationId: createGroupsGroupIdInvitelink
clientGroup: groups
responses: 200Delete Group
http: DELETE /groups/{groupId}
operationId: deleteGroupsGroupId
clientGroup: groups
responses: 200Get Group Info
http: GET /groups/{groupId}
operationId: getGroupsGroupId
clientGroup: groups
responses: 200Get Invite Link
http: GET /groups/{groupId}/inviteLink
operationId: getGroupsGroupIdInvitelink
clientGroup: groups
responses: 200Get Groups List
http: GET /groups
operationId: listGroups
clientGroup: groups
responses: 200Mark message as read
http: POST /readMessage
operationId: createReadMessage
clientGroup: messaging
responses: 200, 401Upload media
http: POST /uploadMedia
operationId: createUploadMedia
clientGroup: messaging
responses: 200Delete media from WABA storage
Delete previously uploaded media by numeric mediaId (from /uploadMedia). This is the canonical deletion endpoint and uses the REST DELETE verb on the media resource path. The older POST /deleteMedia is a deprecated alias.
http: DELETE /media/{mediaId}
operationId: deleteMedia
clientGroup: messaging
responses: 200, 400, 401, 500Delete media from WABA storage (deprecated alias)
Deprecated. Use DELETE /media/{mediaId} instead. This POST alias is kept for backward compatibility with earlier integrations. New integrations should call DELETE /media/{mediaId}: 1msg follows REST conventions for resource deletion going forward (delete a resource with the DELETE verb on its resource path).
http: POST /deleteMedia
operationId: deleteMediaLegacy
clientGroup: messaging
responses: 200, 400, 401, 500Get MM Lite availability and status
http: GET /mmLiteStatus
operationId: getMmLiteStatus
clientGroup: messaging
responses: 200, 401, 500Get messages list
http: GET /messages
operationId: listMessages
clientGroup: messaging
responses: 200Retrieve uploaded media metadata
Get WABA media URL and metadata by mediaId (from uploadMedia). The returned url is temporary and typically expires within ~5 minutes.
http: GET /retrieveMedia
operationId: retrieveMedia
clientGroup: messaging
responses: 200, 400, 401, 500Send address request message
Request shipping address from the user. India only (WhatsApp Cloud API address messages). Requires an India WhatsApp Business number and an India (+91) recipient. Meta validates eligibility; mismatches return WABA errors such as Unsupported Interactive Message type (HTTP 200 with sent: false). The outbound payload always sends action.parameters.country = "IN". A country field in the request body (if present) is ignored.
http: POST /sendAddressMessage
operationId: sendAddressMessage
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send Reply Buttons Message
http: POST /sendButton
operationId: sendButton
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send Carousel
You can send product cards via Carousel in two ways: Template messages: do not require a 24-hour customer service window between you and the recipient. Use sendTemplate. Free-form messages: can be sent only when a customer service window is open between you and the recipient. Use sendCarousel. The message structure in /sendCarousel is largely similar to sending a template. However, in this case you must explicitly specify all elements that are created in advance when working with templates. This is because the message is sent without using a template. In /sendCarousel, for sending a Catalog Carousel there can be either 1 URL button or one or more quick reply buttons.
http: POST /sendCarousel
operationId: sendCarousel
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send a Contact
http: POST /sendContact
operationId: sendContact
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send CTA URL interactive message
Send an interactive message with a single call-to-action URL button.
http: POST /sendCtaUrl
operationId: sendCtaUrl
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send a File
Send a file to an existing chat. (Only if the dialogue has an Open Session). Only one of two parameters is needed to determine the destination - chatId or phone.
http: POST /sendFile
operationId: sendFile
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send WhatsApp Flow Message
Send Interactive WhatsApp Flow message to an existing chat. (Only if the dialogue has an Open Session). Only one of two parameters is needed to determine the destination - chatId or phone. Use this method to send a published WhatsApp Flow as a service (interactive) message. If the 24-hour window is closed, send a template with a FLOW button via /sendTemplate.
http: POST /sendFlow
operationId: sendFlow
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send List Message
http: POST /sendList
operationId: sendList
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send a Location
Send a location to an existing chat. (Only if the dialogue has an Open Session). Only one of two parameters is needed to determine the destination - chatId or phone.
http: POST /sendLocation
operationId: sendLocation
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send Location Request Message
http: POST /sendLocationRequest
operationId: sendLocationRequest
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send a Message
Send a message to an existing chat. (Only if the dialogue has an Open Session). The message will be added to the queue for sending and delivered even if the phone is disconnected from the Internet or authorization is not passed. Only one of two parameters is needed to determine the destination - chatId or phone.
http: POST /sendMessage
operationId: sendMessage
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send order details (India payments template)
Send a WhatsApp order details payment message via a pre-approved Utility template with an ORDER_DETAILS button. India only (WhatsApp Payments India). Requires: - India WhatsApp Business Account / phone number - Commerce-enabled channel - Approved template with an ORDER_DETAILS button Prefer this helper when you want a dedicated payload (order, referenceId, currency, paymentSettings). Under the hood it builds a Cloud API template button component with sub_type: order_details and calls the same path as POST /sendTemplate. To send the same message outside the 24-hour window, you can also call POST /sendTemplate directly with a params button: json { "type": "button", "sub_type": "order_details", "index": 0, "parameters": [{ "type": "action", "action": { "order_details": { "reference_id": "order-123", "type": "digital-goods", "payment_type": "upi", "payment_configuration": "payment_config_name", "currency": "INR", "total_amount": { "offset": 100, "value": 65000 }, "order": { "status": "pending", "items": [], "subtotal": { "offset": 100, "value": 65000 } } } } }] } See Meta/360dialog: Payments India — order details template message.
http: POST /sendOrderDetails
operationId: sendOrderDetails
clientGroup: messaging
responses: 200, 400, 401, 500Send payment request (regional)
Send a regional payment request interactive message (beta scaffold). region must be IN, SG, or BR. Payload shape follows Meta regional payments docs; verify on stage before production use. Full regional builders are not implemented yet.
http: POST /sendPaymentRequest
operationId: sendPaymentRequest
clientGroup: messaging
responses: 200, 400, 401, 500Send a Product
http: POST /sendProduct
operationId: sendProduct
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send Reaction
http: POST /sendReaction
operationId: sendReaction
clientGroup: messaging
responses: 200, 400, 401, 429, 500Send sticker message
Send a WhatsApp sticker by mediaId or link URL.
http: POST /sendSticker
operationId: sendSticker
clientGroup: messaging
responses: 200, 400, 401, 429, 500Get Profile Info
Get WhatsApp Business Account profile information
http: GET /me
operationId: getMe
clientGroup: profile
responses: 200, 401, 500Update profile info
Update WhatsApp Business Account profile fields. At least one of about, description, email, photo, address, vertical, websites is required. Blocked when the channel subscription limit is exceeded.
http: POST /me
operationId: updateMe
clientGroup: profile
responses: 200, 401, 422, 500Create message template
http: POST /addTemplate
operationId: addTemplate
clientGroup: templates
responses: 200, 401, 500Get templates list
http: GET /templates
operationId: listTemplates
clientGroup: templates
responses: 200Remove message template
http: POST /removeTemplate
operationId: removeTemplate
clientGroup: templates
responses: 200, 401, 500Send Template Message
Send a WhatsApp template message (works outside the 24-hour session window). Supported params button sub_type values include: url, quick_reply, copy_code / coupon_code, catalog, flow, limited_time_offer, and order_details (WhatsApp Payments India only — requires an approved Utility template with an ORDER_DETAILS button). For India order/invoice payments outside 24h, include a button component: json { "type": "button", "sub_type": "order_details", "index": 0, "parameters": [{ "type": "action", "action": { "order_details": { "reference_id": "...", "currency": "INR", "order": {} } } }] } Convenience wrapper with structured fields: POST /sendOrderDetails.
http: POST /sendTemplate
operationId: sendTemplate
clientGroup: templates
responses: 200Block WhatsApp user
http: POST /blockUser
operationId: blockUser
clientGroup: users
responses: 200, 400, 401, 500List blocked WhatsApp users
Returns users currently blocked on this WhatsApp channel (WABA GET /block_users). Same channel token auth as blockUser / unblockUser.
http: GET /blockedUsers
operationId: listBlockedUsers
clientGroup: users
responses: 200, 401, 500Unblock WhatsApp user
http: POST /unblockUser
operationId: unblockUser
clientGroup: users
responses: 200, 400, 401, 500Get webhook URL
Returns the configured client webhook URL for this channel.
http: GET /webhook
operationId: getWebhook
clientGroup: webhooks
responses: 200, 401, 500Set webhook URL
Configure the client webhook URL for inbound events.
http: POST /webhook
operationId: setWebhook
clientGroup: webhooks
responses: 200, 401, 500- Install the package from the registry above.
- Set
MSG_API_TOKENandMSG_INSTANCE_ID. - Create the messaging client with
{baseUrl}/{instanceId}. - Call
sendMessageinside the 24h window, orsendTemplateoutside it. - Use group/profile/flows/templates APIs for advanced workflows.
Where is the package? See the registry link in the header table.
TypeScript has createClient — does this SDK? Generated OpenAPI clients use
per-API classes (MessagingApi, ProfileApi, …) instead of a facade.
Can I use this in a browser? No — server-side only. Never expose tokens.
| Code | Meaning |
|---|---|
| 400 | Invalid parameters or body |
| 401 | Invalid or missing token |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
Docs regenerate with node gen/generate-sdk-docs-langs.js. Registry versions are immutable.
MIT © 1MSG