one_msg_sdk 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AGENTS.md +707 -0
- data/README.md +868 -0
- data/lib/one_msg_sdk/version.rb +1 -1
- data/one_msg_sdk.gemspec +2 -2
- metadata +873 -3
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: one_msg_sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 1MSG
|
|
@@ -78,15 +78,885 @@ dependencies:
|
|
|
78
78
|
- - ">="
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
80
|
version: 3.6.0
|
|
81
|
-
description:
|
|
81
|
+
description: |+
|
|
82
|
+
# 1msg Ruby SDK
|
|
83
|
+
|
|
84
|
+
Official Ruby SDK for the **1msg WhatsApp Business API**.
|
|
85
|
+
|
|
86
|
+
This document is generated from the public OpenAPI contract. It covers install,
|
|
87
|
+
auth, quick start, and every public operation available in the client.
|
|
88
|
+
|
|
89
|
+
| | |
|
|
90
|
+
|---|---|
|
|
91
|
+
| **RubyGems** | [`one_msg_sdk`](https://rubygems.org/gems/one_msg_sdk) |
|
|
92
|
+
| **Source** | [github.com/1msg/1msg-sdk/ruby](https://github.com/1msg/1msg-sdk/tree/main/ruby) |
|
|
93
|
+
| **API docs** | [docs.1msg.io](https://docs.1msg.io/) |
|
|
94
|
+
| **Platform** | [platform.1msg.io](https://platform.1msg.io/) |
|
|
95
|
+
| **Support** | support@1msg.io |
|
|
96
|
+
| **OpenAPI version** | 1.0.0 |
|
|
97
|
+
| **Operations** | 60 |
|
|
98
|
+
| **AI agent guide** | [AGENTS.md](./AGENTS.md) |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Install
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
gem install one_msg_sdk -v 2.0.1
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Requirements
|
|
109
|
+
|
|
110
|
+
| Variable | Where to get it | Example |
|
|
111
|
+
|----------|-----------------|---------|
|
|
112
|
+
| `baseUrl` | Platform → channel → API host | `https://api.1msg.io` |
|
|
113
|
+
| `instanceId` | Platform → channel id | `ODI371267300` |
|
|
114
|
+
| `token` | Platform → channel → API token | JWT or API key |
|
|
115
|
+
|
|
116
|
+
Use environment variables (`MSG_API_TOKEN`, `MSG_INSTANCE_ID`). Never commit tokens.
|
|
117
|
+
|
|
118
|
+
## Quick start
|
|
119
|
+
|
|
120
|
+
```ruby
|
|
121
|
+
require 'one_msg_sdk'
|
|
122
|
+
|
|
123
|
+
OneMsgSdk.configure do |config|
|
|
124
|
+
config.host = "https://api.1msg.io/#{ENV.fetch('MSG_INSTANCE_ID')}"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
messaging = OneMsgSdk::MessagingApi.new
|
|
128
|
+
messaging.send_message(
|
|
129
|
+
ENV.fetch('MSG_API_TOKEN'),
|
|
130
|
+
'Hello from 1MSG SDK',
|
|
131
|
+
nil,
|
|
132
|
+
'12020721369@c.us'
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Authentication
|
|
137
|
+
|
|
138
|
+
All requests use query-token auth:
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
https://{baseUrl}/{instanceId}/{path}?token={token}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Pass the channel token as the first argument to generated API methods.
|
|
145
|
+
|
|
146
|
+
## Recipient addressing
|
|
147
|
+
|
|
148
|
+
- `chatId`: `12020721369@c.us` (1:1) or `...@g.us` (group)
|
|
149
|
+
- `phone`: country code + number, no `+`
|
|
150
|
+
- Exactly one of `chatId` | `phone` per request
|
|
151
|
+
|
|
152
|
+
## 24-hour messaging window
|
|
153
|
+
|
|
154
|
+
Free-form `sendMessage` only works inside the 24h customer-care window.
|
|
155
|
+
Outside that window use `sendTemplate`.
|
|
156
|
+
|
|
157
|
+
## Client map
|
|
158
|
+
|
|
159
|
+
```ruby
|
|
160
|
+
MessagingApi # send/list messages, media, interactive
|
|
161
|
+
ProfileApi # getMe
|
|
162
|
+
GroupsApi # create/list/manage groups
|
|
163
|
+
FlowsApi # WhatsApp Flows lifecycle
|
|
164
|
+
TemplatesApi # listTemplates
|
|
165
|
+
ChannelApi # channel helpers
|
|
166
|
+
CallingApi # calling
|
|
167
|
+
WebhooksApi # webhooks
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Package notes
|
|
171
|
+
|
|
172
|
+
Gem name is `one_msg_sdk`. Module is `OneMsgSdk`.
|
|
173
|
+
|
|
174
|
+
## API reference
|
|
175
|
+
|
|
176
|
+
API groups: calling, catalog, channel, flows, groups, messaging, profile, templates, users, webhooks.
|
|
177
|
+
|
|
178
|
+
### calling
|
|
179
|
+
|
|
180
|
+
#### `getCallingSettings`
|
|
181
|
+
|
|
182
|
+
Get calling settings
|
|
183
|
+
|
|
184
|
+
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.
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
http: GET /callingSettings
|
|
188
|
+
operationId: getCallingSettings
|
|
189
|
+
clientGroup: calling
|
|
190
|
+
responses: 200, 401, 500
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### `initiateCall`
|
|
194
|
+
|
|
195
|
+
Initiate WhatsApp call
|
|
196
|
+
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
```yaml
|
|
200
|
+
http: POST /initiateCall
|
|
201
|
+
operationId: initiateCall
|
|
202
|
+
clientGroup: calling
|
|
203
|
+
responses: 200, 401, 500
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### `updateCallingSettings`
|
|
207
|
+
|
|
208
|
+
Update calling settings
|
|
209
|
+
|
|
210
|
+
Update WhatsApp Calling API settings (beta). Requires Meta Calling enablement. Trial/subscription-limited channels are blocked.
|
|
211
|
+
|
|
212
|
+
```yaml
|
|
213
|
+
http: POST /callingSettings
|
|
214
|
+
operationId: updateCallingSettings
|
|
215
|
+
clientGroup: calling
|
|
216
|
+
responses: 200, 401, 500
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### catalog
|
|
220
|
+
|
|
221
|
+
#### `createCommerce`
|
|
222
|
+
|
|
223
|
+
Set Commerce Settings
|
|
224
|
+
|
|
225
|
+
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`).
|
|
226
|
+
|
|
227
|
+
```yaml
|
|
228
|
+
http: POST /commerce
|
|
229
|
+
operationId: createCommerce
|
|
230
|
+
clientGroup: catalog
|
|
231
|
+
responses: 200, 401, 500
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### `getCommerce`
|
|
235
|
+
|
|
236
|
+
Get Commerce Settings
|
|
237
|
+
|
|
238
|
+
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`).
|
|
239
|
+
|
|
240
|
+
```yaml
|
|
241
|
+
http: GET /commerce
|
|
242
|
+
operationId: getCommerce
|
|
243
|
+
clientGroup: catalog
|
|
244
|
+
responses: 200, 401, 500
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### channel
|
|
248
|
+
|
|
249
|
+
#### `getConversationalAutomation`
|
|
250
|
+
|
|
251
|
+
Get conversational automation settings
|
|
252
|
+
|
|
253
|
+
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.
|
|
254
|
+
|
|
255
|
+
```yaml
|
|
256
|
+
http: GET /conversationalAutomation
|
|
257
|
+
operationId: getConversationalAutomation
|
|
258
|
+
clientGroup: channel
|
|
259
|
+
responses: 200, 401, 500
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
#### `getStatus`
|
|
263
|
+
|
|
264
|
+
Get channel status
|
|
265
|
+
|
|
266
|
+
Returns WhatsApp Business API client connection status.
|
|
267
|
+
|
|
268
|
+
```yaml
|
|
269
|
+
http: GET /status
|
|
270
|
+
operationId: getStatus
|
|
271
|
+
clientGroup: channel
|
|
272
|
+
responses: 200, 401, 500
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
#### `setConversationalAutomation`
|
|
276
|
+
|
|
277
|
+
Set conversational automation settings
|
|
278
|
+
|
|
279
|
+
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`.
|
|
280
|
+
|
|
281
|
+
```yaml
|
|
282
|
+
http: POST /conversationalAutomation
|
|
283
|
+
operationId: setConversationalAutomation
|
|
284
|
+
clientGroup: channel
|
|
285
|
+
responses: 200, 401, 500
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### flows
|
|
289
|
+
|
|
290
|
+
#### `createFlows`
|
|
291
|
+
|
|
292
|
+
Create Flow
|
|
293
|
+
|
|
294
|
+
```yaml
|
|
295
|
+
http: POST /flows
|
|
296
|
+
operationId: createFlows
|
|
297
|
+
clientGroup: flows
|
|
298
|
+
responses: 200
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### `createFlowsFlowIdDeprecate`
|
|
302
|
+
|
|
303
|
+
Deprecate Flow
|
|
304
|
+
|
|
305
|
+
```yaml
|
|
306
|
+
http: POST /flows/{flowId}/deprecate
|
|
307
|
+
operationId: createFlowsFlowIdDeprecate
|
|
308
|
+
clientGroup: flows
|
|
309
|
+
responses: 200
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### `createFlowsFlowIdPublish`
|
|
313
|
+
|
|
314
|
+
Publish Flow
|
|
315
|
+
|
|
316
|
+
```yaml
|
|
317
|
+
http: POST /flows/{flowId}/publish
|
|
318
|
+
operationId: createFlowsFlowIdPublish
|
|
319
|
+
clientGroup: flows
|
|
320
|
+
responses: 200
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### `deleteFlowsFlowId`
|
|
324
|
+
|
|
325
|
+
Delete Flow
|
|
326
|
+
|
|
327
|
+
```yaml
|
|
328
|
+
http: DELETE /flows/{flowId}
|
|
329
|
+
operationId: deleteFlowsFlowId
|
|
330
|
+
clientGroup: flows
|
|
331
|
+
responses: 200
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### `getFlowsFlowId`
|
|
335
|
+
|
|
336
|
+
Get Flow Details
|
|
337
|
+
|
|
338
|
+
```yaml
|
|
339
|
+
http: GET /flows/{flowId}
|
|
340
|
+
operationId: getFlowsFlowId
|
|
341
|
+
clientGroup: flows
|
|
342
|
+
responses: 200
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
#### `getFlowsFlowIdPreview`
|
|
346
|
+
|
|
347
|
+
Preview Flow
|
|
348
|
+
|
|
349
|
+
```yaml
|
|
350
|
+
http: GET /flows/{flowId}/preview
|
|
351
|
+
operationId: getFlowsFlowIdPreview
|
|
352
|
+
clientGroup: flows
|
|
353
|
+
responses: 200
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
#### `getWhatsappBusinessEncryption`
|
|
357
|
+
|
|
358
|
+
Get business encryption public key
|
|
359
|
+
|
|
360
|
+
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.
|
|
361
|
+
|
|
362
|
+
```yaml
|
|
363
|
+
http: GET /whatsapp_business_encryption
|
|
364
|
+
operationId: getWhatsappBusinessEncryption
|
|
365
|
+
clientGroup: flows
|
|
366
|
+
responses: 200, 401, 500
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
#### `listFlows`
|
|
370
|
+
|
|
371
|
+
List Flows
|
|
372
|
+
|
|
373
|
+
```yaml
|
|
374
|
+
http: GET /flows
|
|
375
|
+
operationId: listFlows
|
|
376
|
+
clientGroup: flows
|
|
377
|
+
responses: 200
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
#### `patchFlowsFlowIdAssets`
|
|
381
|
+
|
|
382
|
+
Update Flow Structure
|
|
383
|
+
|
|
384
|
+
```yaml
|
|
385
|
+
http: PATCH /flows/{flowId}/assets
|
|
386
|
+
operationId: patchFlowsFlowIdAssets
|
|
387
|
+
clientGroup: flows
|
|
388
|
+
responses: 200
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
#### `patchFlowsFlowIdMetadata`
|
|
392
|
+
|
|
393
|
+
Update Flow Metadata
|
|
394
|
+
|
|
395
|
+
```yaml
|
|
396
|
+
http: PATCH /flows/{flowId}/metadata
|
|
397
|
+
operationId: patchFlowsFlowIdMetadata
|
|
398
|
+
clientGroup: flows
|
|
399
|
+
responses: 200
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
#### `setWhatsappBusinessEncryption`
|
|
403
|
+
|
|
404
|
+
Set business encryption public key
|
|
405
|
+
|
|
406
|
+
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.
|
|
407
|
+
|
|
408
|
+
```yaml
|
|
409
|
+
http: POST /whatsapp_business_encryption
|
|
410
|
+
operationId: setWhatsappBusinessEncryption
|
|
411
|
+
clientGroup: flows
|
|
412
|
+
responses: 200, 400, 401, 500
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### groups
|
|
416
|
+
|
|
417
|
+
#### `createGroups`
|
|
418
|
+
|
|
419
|
+
Create Group
|
|
420
|
+
|
|
421
|
+
```yaml
|
|
422
|
+
http: POST /groups
|
|
423
|
+
operationId: createGroups
|
|
424
|
+
clientGroup: groups
|
|
425
|
+
responses: 200
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
#### `createGroupsGroupId`
|
|
429
|
+
|
|
430
|
+
Update Group Info
|
|
431
|
+
|
|
432
|
+
```yaml
|
|
433
|
+
http: POST /groups/{groupId}
|
|
434
|
+
operationId: createGroupsGroupId
|
|
435
|
+
clientGroup: groups
|
|
436
|
+
responses: 200
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
#### `createGroupsGroupIdInvitelink`
|
|
440
|
+
|
|
441
|
+
Reset Invite Link
|
|
442
|
+
|
|
443
|
+
```yaml
|
|
444
|
+
http: POST /groups/{groupId}/inviteLink
|
|
445
|
+
operationId: createGroupsGroupIdInvitelink
|
|
446
|
+
clientGroup: groups
|
|
447
|
+
responses: 200
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
#### `deleteGroupsGroupId`
|
|
451
|
+
|
|
452
|
+
Delete Group
|
|
453
|
+
|
|
454
|
+
```yaml
|
|
455
|
+
http: DELETE /groups/{groupId}
|
|
456
|
+
operationId: deleteGroupsGroupId
|
|
457
|
+
clientGroup: groups
|
|
458
|
+
responses: 200
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
#### `getGroupsGroupId`
|
|
462
|
+
|
|
463
|
+
Get Group Info
|
|
464
|
+
|
|
465
|
+
```yaml
|
|
466
|
+
http: GET /groups/{groupId}
|
|
467
|
+
operationId: getGroupsGroupId
|
|
468
|
+
clientGroup: groups
|
|
469
|
+
responses: 200
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
#### `getGroupsGroupIdInvitelink`
|
|
473
|
+
|
|
474
|
+
Get Invite Link
|
|
475
|
+
|
|
476
|
+
```yaml
|
|
477
|
+
http: GET /groups/{groupId}/inviteLink
|
|
478
|
+
operationId: getGroupsGroupIdInvitelink
|
|
479
|
+
clientGroup: groups
|
|
480
|
+
responses: 200
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
#### `listGroups`
|
|
484
|
+
|
|
485
|
+
Get Groups List
|
|
486
|
+
|
|
487
|
+
```yaml
|
|
488
|
+
http: GET /groups
|
|
489
|
+
operationId: listGroups
|
|
490
|
+
clientGroup: groups
|
|
491
|
+
responses: 200
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### messaging
|
|
495
|
+
|
|
496
|
+
#### `createReadMessage`
|
|
497
|
+
|
|
498
|
+
Mark message as read
|
|
499
|
+
|
|
500
|
+
```yaml
|
|
501
|
+
http: POST /readMessage
|
|
502
|
+
operationId: createReadMessage
|
|
503
|
+
clientGroup: messaging
|
|
504
|
+
responses: 200, 401
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
#### `createUploadMedia`
|
|
508
|
+
|
|
509
|
+
Upload media
|
|
510
|
+
|
|
511
|
+
```yaml
|
|
512
|
+
http: POST /uploadMedia
|
|
513
|
+
operationId: createUploadMedia
|
|
514
|
+
clientGroup: messaging
|
|
515
|
+
responses: 200
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
#### `deleteMedia`
|
|
519
|
+
|
|
520
|
+
Delete media from WABA storage
|
|
521
|
+
|
|
522
|
+
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.
|
|
523
|
+
|
|
524
|
+
```yaml
|
|
525
|
+
http: DELETE /media/{mediaId}
|
|
526
|
+
operationId: deleteMedia
|
|
527
|
+
clientGroup: messaging
|
|
528
|
+
responses: 200, 400, 401, 500
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
#### `deleteMediaLegacy`
|
|
532
|
+
|
|
533
|
+
Delete media from WABA storage (deprecated alias)
|
|
534
|
+
|
|
535
|
+
**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).
|
|
536
|
+
|
|
537
|
+
```yaml
|
|
538
|
+
http: POST /deleteMedia
|
|
539
|
+
operationId: deleteMediaLegacy
|
|
540
|
+
clientGroup: messaging
|
|
541
|
+
responses: 200, 400, 401, 500
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
#### `getMmLiteStatus`
|
|
545
|
+
|
|
546
|
+
Get MM Lite availability and status
|
|
547
|
+
|
|
548
|
+
```yaml
|
|
549
|
+
http: GET /mmLiteStatus
|
|
550
|
+
operationId: getMmLiteStatus
|
|
551
|
+
clientGroup: messaging
|
|
552
|
+
responses: 200, 401, 500
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
#### `listMessages`
|
|
556
|
+
|
|
557
|
+
Get messages list
|
|
558
|
+
|
|
559
|
+
```yaml
|
|
560
|
+
http: GET /messages
|
|
561
|
+
operationId: listMessages
|
|
562
|
+
clientGroup: messaging
|
|
563
|
+
responses: 200
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
#### `retrieveMedia`
|
|
567
|
+
|
|
568
|
+
Retrieve uploaded media metadata
|
|
569
|
+
|
|
570
|
+
Get WABA media URL and metadata by mediaId (from uploadMedia). The returned `url` is temporary and typically expires within ~5 minutes.
|
|
571
|
+
|
|
572
|
+
```yaml
|
|
573
|
+
http: GET /retrieveMedia
|
|
574
|
+
operationId: retrieveMedia
|
|
575
|
+
clientGroup: messaging
|
|
576
|
+
responses: 200, 400, 401, 500
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
#### `sendAddressMessage`
|
|
580
|
+
|
|
581
|
+
Send address request message
|
|
582
|
+
|
|
583
|
+
Request shipping address from the user (WhatsApp interactive `address_message`). **India and Singapore only.** Requires: - Business WhatsApp number registered in that country - Recipient phone matching the country (`+91` ↔ `IN`, `+65` ↔ `SG`) Pass `country: "IN"` or `country: "SG"`. Eligibility is validated upstream; mismatches (e.g. Singapore phone with `country: "IN"`) return errors such as `Unsupported Interactive Message type` (HTTP 200 with `sent: false`). Optional action parameters: `values`, `saved_addresses`, `validation_errors`.
|
|
584
|
+
|
|
585
|
+
```yaml
|
|
586
|
+
http: POST /sendAddressMessage
|
|
587
|
+
operationId: sendAddressMessage
|
|
588
|
+
clientGroup: messaging
|
|
589
|
+
responses: 200, 400, 401, 429, 500
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
#### `sendButton`
|
|
593
|
+
|
|
594
|
+
Send Reply Buttons Message
|
|
595
|
+
|
|
596
|
+
```yaml
|
|
597
|
+
http: POST /sendButton
|
|
598
|
+
operationId: sendButton
|
|
599
|
+
clientGroup: messaging
|
|
600
|
+
responses: 200, 400, 401, 429, 500
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
#### `sendCarousel`
|
|
604
|
+
|
|
605
|
+
Send Carousel
|
|
606
|
+
|
|
607
|
+
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.
|
|
608
|
+
|
|
609
|
+
```yaml
|
|
610
|
+
http: POST /sendCarousel
|
|
611
|
+
operationId: sendCarousel
|
|
612
|
+
clientGroup: messaging
|
|
613
|
+
responses: 200, 400, 401, 429, 500
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
#### `sendContact`
|
|
617
|
+
|
|
618
|
+
Send a Contact
|
|
619
|
+
|
|
620
|
+
```yaml
|
|
621
|
+
http: POST /sendContact
|
|
622
|
+
operationId: sendContact
|
|
623
|
+
clientGroup: messaging
|
|
624
|
+
responses: 200, 400, 401, 429, 500
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
#### `sendCtaUrl`
|
|
628
|
+
|
|
629
|
+
Send CTA URL interactive message
|
|
630
|
+
|
|
631
|
+
Send an interactive message with a single call-to-action URL button.
|
|
632
|
+
|
|
633
|
+
```yaml
|
|
634
|
+
http: POST /sendCtaUrl
|
|
635
|
+
operationId: sendCtaUrl
|
|
636
|
+
clientGroup: messaging
|
|
637
|
+
responses: 200, 400, 401, 429, 500
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
#### `sendFile`
|
|
641
|
+
|
|
642
|
+
Send a File
|
|
643
|
+
|
|
644
|
+
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.
|
|
645
|
+
|
|
646
|
+
```yaml
|
|
647
|
+
http: POST /sendFile
|
|
648
|
+
operationId: sendFile
|
|
649
|
+
clientGroup: messaging
|
|
650
|
+
responses: 200, 400, 401, 429, 500
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
#### `sendFlow`
|
|
654
|
+
|
|
655
|
+
Send WhatsApp Flow Message
|
|
656
|
+
|
|
657
|
+
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.
|
|
658
|
+
|
|
659
|
+
```yaml
|
|
660
|
+
http: POST /sendFlow
|
|
661
|
+
operationId: sendFlow
|
|
662
|
+
clientGroup: messaging
|
|
663
|
+
responses: 200, 400, 401, 429, 500
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
#### `sendList`
|
|
667
|
+
|
|
668
|
+
Send List Message
|
|
669
|
+
|
|
670
|
+
```yaml
|
|
671
|
+
http: POST /sendList
|
|
672
|
+
operationId: sendList
|
|
673
|
+
clientGroup: messaging
|
|
674
|
+
responses: 200, 400, 401, 429, 500
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
#### `sendLocation`
|
|
678
|
+
|
|
679
|
+
Send a Location
|
|
680
|
+
|
|
681
|
+
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.
|
|
682
|
+
|
|
683
|
+
```yaml
|
|
684
|
+
http: POST /sendLocation
|
|
685
|
+
operationId: sendLocation
|
|
686
|
+
clientGroup: messaging
|
|
687
|
+
responses: 200, 400, 401, 429, 500
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
#### `sendLocationRequest`
|
|
691
|
+
|
|
692
|
+
Send Location Request Message
|
|
693
|
+
|
|
694
|
+
```yaml
|
|
695
|
+
http: POST /sendLocationRequest
|
|
696
|
+
operationId: sendLocationRequest
|
|
697
|
+
clientGroup: messaging
|
|
698
|
+
responses: 200, 400, 401, 429, 500
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
#### `sendMessage`
|
|
702
|
+
|
|
703
|
+
Send a Message
|
|
704
|
+
|
|
705
|
+
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.
|
|
706
|
+
|
|
707
|
+
```yaml
|
|
708
|
+
http: POST /sendMessage
|
|
709
|
+
operationId: sendMessage
|
|
710
|
+
clientGroup: messaging
|
|
711
|
+
responses: 200, 400, 401, 429, 500
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
#### `sendOrderDetails`
|
|
715
|
+
|
|
716
|
+
Send order details (India payments template)
|
|
717
|
+
|
|
718
|
+
Send a WhatsApp **order details** payment / invoice message using a pre-approved **Utility** template that has an `ORDER_DETAILS` button. **India only** (WhatsApp Payments India). Requires: - India WhatsApp Business number - Commerce enabled on the channel (`GET`/`POST /commerce`) - Approved template with an `ORDER_DETAILS` button Use this method when you need structured fields (`order`, `referenceId`, `currency`, `paymentSettings`). The API appends a template button `sub_type: order_details` and sends via the same path as `POST /sendTemplate`. Works **outside the 24-hour session window** (template message). You can also send the same payload yourself with `POST /sendTemplate` by including a button component in `params`: ```json { "type": "button", "sub_type": "order_details", "index": 0, "parameters": [{ "type": "action", "action": { "order_details": { "reference_id": "order-123", "currency": "INR", "order": { "status": "pending", "items": [], "subtotal": { "offset": 100, "value": 50000 } } } } }] } ```
|
|
719
|
+
|
|
720
|
+
```yaml
|
|
721
|
+
http: POST /sendOrderDetails
|
|
722
|
+
operationId: sendOrderDetails
|
|
723
|
+
clientGroup: messaging
|
|
724
|
+
responses: 200, 400, 401, 500
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
#### `sendPaymentRequest`
|
|
728
|
+
|
|
729
|
+
Send payment request (regional)
|
|
730
|
+
|
|
731
|
+
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.
|
|
732
|
+
|
|
733
|
+
```yaml
|
|
734
|
+
http: POST /sendPaymentRequest
|
|
735
|
+
operationId: sendPaymentRequest
|
|
736
|
+
clientGroup: messaging
|
|
737
|
+
responses: 200, 400, 401, 500
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
#### `sendProduct`
|
|
741
|
+
|
|
742
|
+
Send a Product
|
|
743
|
+
|
|
744
|
+
```yaml
|
|
745
|
+
http: POST /sendProduct
|
|
746
|
+
operationId: sendProduct
|
|
747
|
+
clientGroup: messaging
|
|
748
|
+
responses: 200, 400, 401, 429, 500
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
#### `sendReaction`
|
|
752
|
+
|
|
753
|
+
Send Reaction
|
|
754
|
+
|
|
755
|
+
```yaml
|
|
756
|
+
http: POST /sendReaction
|
|
757
|
+
operationId: sendReaction
|
|
758
|
+
clientGroup: messaging
|
|
759
|
+
responses: 200, 400, 401, 429, 500
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
#### `sendSticker`
|
|
763
|
+
|
|
764
|
+
Send sticker message
|
|
765
|
+
|
|
766
|
+
Send a WhatsApp sticker by mediaId or link URL.
|
|
767
|
+
|
|
768
|
+
```yaml
|
|
769
|
+
http: POST /sendSticker
|
|
770
|
+
operationId: sendSticker
|
|
771
|
+
clientGroup: messaging
|
|
772
|
+
responses: 200, 400, 401, 429, 500
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
### profile
|
|
776
|
+
|
|
777
|
+
#### `getMe`
|
|
778
|
+
|
|
779
|
+
Get Profile Info
|
|
780
|
+
|
|
781
|
+
Get WhatsApp Business Account profile information
|
|
782
|
+
|
|
783
|
+
```yaml
|
|
784
|
+
http: GET /me
|
|
785
|
+
operationId: getMe
|
|
786
|
+
clientGroup: profile
|
|
787
|
+
responses: 200, 401, 500
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
#### `updateMe`
|
|
791
|
+
|
|
792
|
+
Update profile info
|
|
793
|
+
|
|
794
|
+
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.
|
|
795
|
+
|
|
796
|
+
```yaml
|
|
797
|
+
http: POST /me
|
|
798
|
+
operationId: updateMe
|
|
799
|
+
clientGroup: profile
|
|
800
|
+
responses: 200, 401, 422, 500
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
### templates
|
|
804
|
+
|
|
805
|
+
#### `addTemplate`
|
|
806
|
+
|
|
807
|
+
Create message template
|
|
808
|
+
|
|
809
|
+
```yaml
|
|
810
|
+
http: POST /addTemplate
|
|
811
|
+
operationId: addTemplate
|
|
812
|
+
clientGroup: templates
|
|
813
|
+
responses: 200, 401, 500
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
#### `listTemplates`
|
|
817
|
+
|
|
818
|
+
Get templates list
|
|
819
|
+
|
|
820
|
+
```yaml
|
|
821
|
+
http: GET /templates
|
|
822
|
+
operationId: listTemplates
|
|
823
|
+
clientGroup: templates
|
|
824
|
+
responses: 200
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
#### `removeTemplate`
|
|
828
|
+
|
|
829
|
+
Remove message template
|
|
830
|
+
|
|
831
|
+
```yaml
|
|
832
|
+
http: POST /removeTemplate
|
|
833
|
+
operationId: removeTemplate
|
|
834
|
+
clientGroup: templates
|
|
835
|
+
responses: 200, 401, 500
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
#### `sendTemplate`
|
|
839
|
+
|
|
840
|
+
Send Template Message
|
|
841
|
+
|
|
842
|
+
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`.
|
|
843
|
+
|
|
844
|
+
```yaml
|
|
845
|
+
http: POST /sendTemplate
|
|
846
|
+
operationId: sendTemplate
|
|
847
|
+
clientGroup: templates
|
|
848
|
+
responses: 200
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
### users
|
|
852
|
+
|
|
853
|
+
#### `blockUser`
|
|
854
|
+
|
|
855
|
+
Block WhatsApp user
|
|
856
|
+
|
|
857
|
+
```yaml
|
|
858
|
+
http: POST /blockUser
|
|
859
|
+
operationId: blockUser
|
|
860
|
+
clientGroup: users
|
|
861
|
+
responses: 200, 400, 401, 500
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
#### `listBlockedUsers`
|
|
865
|
+
|
|
866
|
+
List blocked WhatsApp users
|
|
867
|
+
|
|
868
|
+
Returns users currently blocked on this WhatsApp channel (WABA `GET /block_users`). Same channel token auth as `blockUser` / `unblockUser`.
|
|
869
|
+
|
|
870
|
+
```yaml
|
|
871
|
+
http: GET /blockedUsers
|
|
872
|
+
operationId: listBlockedUsers
|
|
873
|
+
clientGroup: users
|
|
874
|
+
responses: 200, 401, 500
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
#### `unblockUser`
|
|
878
|
+
|
|
879
|
+
Unblock WhatsApp user
|
|
880
|
+
|
|
881
|
+
```yaml
|
|
882
|
+
http: POST /unblockUser
|
|
883
|
+
operationId: unblockUser
|
|
884
|
+
clientGroup: users
|
|
885
|
+
responses: 200, 400, 401, 500
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
### webhooks
|
|
889
|
+
|
|
890
|
+
#### `getWebhook`
|
|
891
|
+
|
|
892
|
+
Get webhook URL
|
|
893
|
+
|
|
894
|
+
Returns the configured client webhook URL for this channel.
|
|
895
|
+
|
|
896
|
+
```yaml
|
|
897
|
+
http: GET /webhook
|
|
898
|
+
operationId: getWebhook
|
|
899
|
+
clientGroup: webhooks
|
|
900
|
+
responses: 200, 401, 500
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
#### `setWebhook`
|
|
904
|
+
|
|
905
|
+
Set webhook URL
|
|
906
|
+
|
|
907
|
+
Configure the client webhook URL for inbound events.
|
|
908
|
+
|
|
909
|
+
```yaml
|
|
910
|
+
http: POST /webhook
|
|
911
|
+
operationId: setWebhook
|
|
912
|
+
clientGroup: webhooks
|
|
913
|
+
responses: 200, 401, 500
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
## Cookbook
|
|
917
|
+
|
|
918
|
+
1. Install the package from the registry above.
|
|
919
|
+
2. Set `MSG_API_TOKEN` and `MSG_INSTANCE_ID`.
|
|
920
|
+
3. Create the messaging client with `{baseUrl}/{instanceId}`.
|
|
921
|
+
4. Call `sendMessage` inside the 24h window, or `sendTemplate` outside it.
|
|
922
|
+
5. Use group/profile/flows/templates APIs for advanced workflows.
|
|
923
|
+
|
|
924
|
+
## FAQ
|
|
925
|
+
|
|
926
|
+
**Where is the package?** See the registry link in the header table.
|
|
927
|
+
|
|
928
|
+
**TypeScript has createClient — does this SDK?** Generated OpenAPI clients use
|
|
929
|
+
per-API classes (`MessagingApi`, `ProfileApi`, …) instead of a facade.
|
|
930
|
+
|
|
931
|
+
**Can I use this in a browser?** No — server-side only. Never expose tokens.
|
|
932
|
+
|
|
933
|
+
## Error handling
|
|
934
|
+
|
|
935
|
+
| Code | Meaning |
|
|
936
|
+
|------|---------|
|
|
937
|
+
| 400 | Invalid parameters or body |
|
|
938
|
+
| 401 | Invalid or missing token |
|
|
939
|
+
| 429 | Rate limit exceeded |
|
|
940
|
+
| 500 | Internal server error |
|
|
941
|
+
|
|
942
|
+
## Regeneration and versioning
|
|
943
|
+
|
|
944
|
+
Docs regenerate with `node gen/generate-sdk-docs-langs.js`. Registry versions are immutable.
|
|
945
|
+
|
|
946
|
+
## License
|
|
947
|
+
|
|
948
|
+
MIT © 1MSG
|
|
949
|
+
|
|
82
950
|
email:
|
|
83
951
|
- support@1msg.io
|
|
84
952
|
executables: []
|
|
85
953
|
extensions: []
|
|
86
954
|
extra_rdoc_files: []
|
|
87
955
|
files:
|
|
956
|
+
- AGENTS.md
|
|
88
957
|
- Gemfile
|
|
89
958
|
- LICENSE.txt
|
|
959
|
+
- README.md
|
|
90
960
|
- Rakefile
|
|
91
961
|
- docs/AddTemplateRequest.md
|
|
92
962
|
- docs/BlockUserRequest.md
|
|
@@ -332,7 +1202,7 @@ requirements: []
|
|
|
332
1202
|
rubygems_version: 3.4.19
|
|
333
1203
|
signing_key:
|
|
334
1204
|
specification_version: 4
|
|
335
|
-
summary: Official Ruby SDK for the 1msg WhatsApp Business API
|
|
1205
|
+
summary: ""Official Ruby SDK for the 1msg WhatsApp Business API""
|
|
336
1206
|
test_files:
|
|
337
1207
|
- spec/api/groups_api_spec.rb
|
|
338
1208
|
- spec/api/catalog_api_spec.rb
|