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