one_msg_chat_api 1.0.0
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 +7 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +10 -0
- data/docs/AddTemplateRequest.md +24 -0
- data/docs/BlockUserRequest.md +18 -0
- data/docs/CallingApi.md +231 -0
- data/docs/CatalogApi.md +153 -0
- data/docs/ChannelApi.md +225 -0
- data/docs/ConversationalAutomation.md +22 -0
- data/docs/ConversationalAutomationCommandsInner.md +20 -0
- data/docs/CreateCommerce200Response.md +18 -0
- data/docs/CreateCommerceRequest.md +18 -0
- data/docs/CreateCommerceRequestParams.md +20 -0
- data/docs/CreateGroups200Response.md +18 -0
- data/docs/CreateReadMessage200Response.md +18 -0
- data/docs/CreateReadMessage401Response.md +18 -0
- data/docs/CreateReadMessageRequest.md +22 -0
- data/docs/DeleteFlowsFlowId200Response.md +20 -0
- data/docs/DeleteGroupsGroupId200Response.md +20 -0
- data/docs/DeleteMediaLegacyRequest.md +18 -0
- data/docs/ErrorResponse.md +18 -0
- data/docs/FlowsApi.md +836 -0
- data/docs/GetCommerce200ResponseInner.md +22 -0
- data/docs/GetMmLiteStatus200Response.md +22 -0
- data/docs/GetWebhook200Response.md +18 -0
- data/docs/GetWhatsappBusinessEncryption200Response.md +22 -0
- data/docs/GroupsApi.md +507 -0
- data/docs/ListBlockedUsers200Response.md +18 -0
- data/docs/ListFlows200Response.md +26 -0
- data/docs/ListMessages200Response.md +20 -0
- data/docs/ListTemplates200Response.md +22 -0
- data/docs/MessageSentResponse.md +24 -0
- data/docs/MessagingApi.md +1784 -0
- data/docs/PatchFlowsFlowIdAssets200Response.md +22 -0
- data/docs/ProfileApi.md +155 -0
- data/docs/ProfileInfo.md +32 -0
- data/docs/RetrieveMedia200Response.md +26 -0
- data/docs/SendAddressMessageRequest.md +32 -0
- data/docs/SendButtonRequest.md +24 -0
- data/docs/SendButtonRequestSectionsInner.md +20 -0
- data/docs/SendButtonRequestSectionsInnerReply.md +20 -0
- data/docs/SendCarouselRequest1.md +26 -0
- data/docs/SendContactRequest.md +20 -0
- data/docs/SendContactRequestContactsInner.md +30 -0
- data/docs/SendContactRequestContactsInnerName.md +28 -0
- data/docs/SendContactRequestContactsInnerOrg.md +22 -0
- data/docs/SendContactRequestContactsInnerPhonesInner.md +22 -0
- data/docs/SendCtaUrlRequest.md +32 -0
- data/docs/SendFileRequest.md +34 -0
- data/docs/SendFlowRequest1.md +46 -0
- data/docs/SendFlowRequest1Header.md +49 -0
- data/docs/SendFlowRequestHeader.md +49 -0
- data/docs/SendListRequest.md +26 -0
- data/docs/SendListRequestSectionsInner.md +20 -0
- data/docs/SendListRequestSectionsInnerRowsInner.md +22 -0
- data/docs/SendLocationRequest1.md +30 -0
- data/docs/SendLocationRequestRequest.md +20 -0
- data/docs/SendMessageRequest.md +24 -0
- data/docs/SendOrderDetailsRequest.md +36 -0
- data/docs/SendOrderDetailsRequestLanguage.md +20 -0
- data/docs/SendOrderDetailsRequestOrder.md +28 -0
- data/docs/SendOrderDetailsRequestOrderItemsInner.md +24 -0
- data/docs/SendOrderDetailsRequestOrderItemsInnerAmount.md +20 -0
- data/docs/SendPaymentRequestRequest.md +26 -0
- data/docs/SendReactionRequest.md +22 -0
- data/docs/SendStickerRequest.md +26 -0
- data/docs/SendTemplateRequest.md +32 -0
- data/docs/SendTemplateRequestLanguage.md +20 -0
- data/docs/SetWhatsappBusinessEncryptionRequest.md +21 -0
- data/docs/SuccessResponse.md +18 -0
- data/docs/TemplatesApi.md +301 -0
- data/docs/UpdateMeRequest.md +30 -0
- data/docs/UsersApi.md +223 -0
- data/docs/WebhooksApi.md +155 -0
- data/git_push.sh +57 -0
- data/lib/one_msg_chat_api/api/calling_api.rb +228 -0
- data/lib/one_msg_chat_api/api/catalog_api.rb +161 -0
- data/lib/one_msg_chat_api/api/channel_api.rb +225 -0
- data/lib/one_msg_chat_api/api/flows_api.rb +788 -0
- data/lib/one_msg_chat_api/api/groups_api.rb +486 -0
- data/lib/one_msg_chat_api/api/messaging_api.rb +1833 -0
- data/lib/one_msg_chat_api/api/profile_api.rb +157 -0
- data/lib/one_msg_chat_api/api/templates_api.rb +293 -0
- data/lib/one_msg_chat_api/api/users_api.rb +232 -0
- data/lib/one_msg_chat_api/api/webhooks_api.rb +157 -0
- data/lib/one_msg_chat_api/api_client.rb +441 -0
- data/lib/one_msg_chat_api/api_error.rb +58 -0
- data/lib/one_msg_chat_api/api_model_base.rb +88 -0
- data/lib/one_msg_chat_api/configuration.rb +400 -0
- data/lib/one_msg_chat_api/models/add_template_request.rb +176 -0
- data/lib/one_msg_chat_api/models/block_user_request.rb +164 -0
- data/lib/one_msg_chat_api/models/conversational_automation.rb +210 -0
- data/lib/one_msg_chat_api/models/conversational_automation_commands_inner.rb +208 -0
- data/lib/one_msg_chat_api/models/create_commerce200_response.rb +147 -0
- data/lib/one_msg_chat_api/models/create_commerce_request.rb +164 -0
- data/lib/one_msg_chat_api/models/create_commerce_request_params.rb +192 -0
- data/lib/one_msg_chat_api/models/create_groups200_response.rb +149 -0
- data/lib/one_msg_chat_api/models/create_read_message200_response.rb +147 -0
- data/lib/one_msg_chat_api/models/create_read_message401_response.rb +147 -0
- data/lib/one_msg_chat_api/models/create_read_message_request.rb +168 -0
- data/lib/one_msg_chat_api/models/delete_flows_flow_id200_response.rb +158 -0
- data/lib/one_msg_chat_api/models/delete_groups_group_id200_response.rb +158 -0
- data/lib/one_msg_chat_api/models/delete_media_legacy_request.rb +165 -0
- data/lib/one_msg_chat_api/models/error_response.rb +149 -0
- data/lib/one_msg_chat_api/models/get_commerce200_response_inner.rb +168 -0
- data/lib/one_msg_chat_api/models/get_mm_lite_status200_response.rb +165 -0
- data/lib/one_msg_chat_api/models/get_webhook200_response.rb +147 -0
- data/lib/one_msg_chat_api/models/get_whatsapp_business_encryption200_response.rb +202 -0
- data/lib/one_msg_chat_api/models/list_blocked_users200_response.rb +149 -0
- data/lib/one_msg_chat_api/models/list_flows200_response.rb +189 -0
- data/lib/one_msg_chat_api/models/list_messages200_response.rb +158 -0
- data/lib/one_msg_chat_api/models/list_templates200_response.rb +169 -0
- data/lib/one_msg_chat_api/models/message_sent_response.rb +179 -0
- data/lib/one_msg_chat_api/models/patch_flows_flow_id_assets200_response.rb +169 -0
- data/lib/one_msg_chat_api/models/profile_info.rb +254 -0
- data/lib/one_msg_chat_api/models/retrieve_media200_response.rb +183 -0
- data/lib/one_msg_chat_api/models/send_address_message_request.rb +273 -0
- data/lib/one_msg_chat_api/models/send_button_request.rb +176 -0
- data/lib/one_msg_chat_api/models/send_button_request_sections_inner.rb +156 -0
- data/lib/one_msg_chat_api/models/send_button_request_sections_inner_reply.rb +156 -0
- data/lib/one_msg_chat_api/models/send_carousel_request1.rb +202 -0
- data/lib/one_msg_chat_api/models/send_contact_request.rb +158 -0
- data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner.rb +209 -0
- data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_name.rb +192 -0
- data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_org.rb +165 -0
- data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_phones_inner.rb +165 -0
- data/lib/one_msg_chat_api/models/send_cta_url_request.rb +264 -0
- data/lib/one_msg_chat_api/models/send_file_request.rb +278 -0
- data/lib/one_msg_chat_api/models/send_flow_request1.rb +387 -0
- data/lib/one_msg_chat_api/models/send_flow_request1_header.rb +104 -0
- data/lib/one_msg_chat_api/models/send_flow_request_header.rb +105 -0
- data/lib/one_msg_chat_api/models/send_list_request.rb +185 -0
- data/lib/one_msg_chat_api/models/send_list_request_sections_inner.rb +158 -0
- data/lib/one_msg_chat_api/models/send_list_request_sections_inner_rows_inner.rb +165 -0
- data/lib/one_msg_chat_api/models/send_location_request1.rb +235 -0
- data/lib/one_msg_chat_api/models/send_location_request_request.rb +156 -0
- data/lib/one_msg_chat_api/models/send_message_request.rb +284 -0
- data/lib/one_msg_chat_api/models/send_order_details_request.rb +308 -0
- data/lib/one_msg_chat_api/models/send_order_details_request_language.rb +176 -0
- data/lib/one_msg_chat_api/models/send_order_details_request_order.rb +220 -0
- data/lib/one_msg_chat_api/models/send_order_details_request_order_items_inner.rb +174 -0
- data/lib/one_msg_chat_api/models/send_order_details_request_order_items_inner_amount.rb +156 -0
- data/lib/one_msg_chat_api/models/send_payment_request_request.rb +245 -0
- data/lib/one_msg_chat_api/models/send_reaction_request.rb +165 -0
- data/lib/one_msg_chat_api/models/send_sticker_request.rb +185 -0
- data/lib/one_msg_chat_api/models/send_template_request.rb +215 -0
- data/lib/one_msg_chat_api/models/send_template_request_language.rb +156 -0
- data/lib/one_msg_chat_api/models/set_whatsapp_business_encryption_request.rb +165 -0
- data/lib/one_msg_chat_api/models/success_response.rb +149 -0
- data/lib/one_msg_chat_api/models/update_me_request.rb +207 -0
- data/lib/one_msg_chat_api/version.rb +15 -0
- data/lib/one_msg_chat_api.rb +111 -0
- data/one_msg_chat_api.gemspec +41 -0
- data/spec/api/calling_api_spec.rb +73 -0
- data/spec/api/catalog_api_spec.rb +60 -0
- data/spec/api/channel_api_spec.rb +72 -0
- data/spec/api/flows_api_spec.rb +175 -0
- data/spec/api/groups_api_spec.rb +117 -0
- data/spec/api/messaging_api_spec.rb +359 -0
- data/spec/api/profile_api_spec.rb +60 -0
- data/spec/api/templates_api_spec.rb +83 -0
- data/spec/api/users_api_spec.rb +71 -0
- data/spec/api/webhooks_api_spec.rb +60 -0
- data/spec/models/add_template_request_spec.rb +54 -0
- data/spec/models/block_user_request_spec.rb +36 -0
- data/spec/models/conversational_automation_commands_inner_spec.rb +42 -0
- data/spec/models/conversational_automation_spec.rb +48 -0
- data/spec/models/create_commerce200_response_spec.rb +36 -0
- data/spec/models/create_commerce_request_params_spec.rb +42 -0
- data/spec/models/create_commerce_request_spec.rb +36 -0
- data/spec/models/create_groups200_response_spec.rb +36 -0
- data/spec/models/create_read_message200_response_spec.rb +36 -0
- data/spec/models/create_read_message401_response_spec.rb +36 -0
- data/spec/models/create_read_message_request_spec.rb +48 -0
- data/spec/models/delete_flows_flow_id200_response_spec.rb +42 -0
- data/spec/models/delete_groups_group_id200_response_spec.rb +42 -0
- data/spec/models/delete_media_legacy_request_spec.rb +36 -0
- data/spec/models/error_response_spec.rb +36 -0
- data/spec/models/get_commerce200_response_inner_spec.rb +48 -0
- data/spec/models/get_mm_lite_status200_response_spec.rb +48 -0
- data/spec/models/get_webhook200_response_spec.rb +36 -0
- data/spec/models/get_whatsapp_business_encryption200_response_spec.rb +52 -0
- data/spec/models/list_blocked_users200_response_spec.rb +36 -0
- data/spec/models/list_flows200_response_spec.rb +60 -0
- data/spec/models/list_messages200_response_spec.rb +42 -0
- data/spec/models/list_templates200_response_spec.rb +48 -0
- data/spec/models/message_sent_response_spec.rb +54 -0
- data/spec/models/patch_flows_flow_id_assets200_response_spec.rb +48 -0
- data/spec/models/profile_info_spec.rb +82 -0
- data/spec/models/retrieve_media200_response_spec.rb +60 -0
- data/spec/models/send_address_message_request_spec.rb +82 -0
- data/spec/models/send_button_request_sections_inner_reply_spec.rb +42 -0
- data/spec/models/send_button_request_sections_inner_spec.rb +42 -0
- data/spec/models/send_button_request_spec.rb +54 -0
- data/spec/models/send_carousel_request1_spec.rb +60 -0
- data/spec/models/send_contact_request_contacts_inner_name_spec.rb +66 -0
- data/spec/models/send_contact_request_contacts_inner_org_spec.rb +48 -0
- data/spec/models/send_contact_request_contacts_inner_phones_inner_spec.rb +48 -0
- data/spec/models/send_contact_request_contacts_inner_spec.rb +72 -0
- data/spec/models/send_contact_request_spec.rb +42 -0
- data/spec/models/send_cta_url_request_spec.rb +78 -0
- data/spec/models/send_file_request_spec.rb +88 -0
- data/spec/models/send_flow_request1_header_spec.rb +32 -0
- data/spec/models/send_flow_request1_spec.rb +128 -0
- data/spec/models/send_flow_request_header_spec.rb +32 -0
- data/spec/models/send_list_request_sections_inner_rows_inner_spec.rb +48 -0
- data/spec/models/send_list_request_sections_inner_spec.rb +42 -0
- data/spec/models/send_list_request_spec.rb +60 -0
- data/spec/models/send_location_request1_spec.rb +72 -0
- data/spec/models/send_location_request_request_spec.rb +42 -0
- data/spec/models/send_message_request_spec.rb +54 -0
- data/spec/models/send_order_details_request_language_spec.rb +42 -0
- data/spec/models/send_order_details_request_order_items_inner_amount_spec.rb +42 -0
- data/spec/models/send_order_details_request_order_items_inner_spec.rb +54 -0
- data/spec/models/send_order_details_request_order_spec.rb +66 -0
- data/spec/models/send_order_details_request_spec.rb +90 -0
- data/spec/models/send_payment_request_request_spec.rb +64 -0
- data/spec/models/send_reaction_request_spec.rb +48 -0
- data/spec/models/send_sticker_request_spec.rb +60 -0
- data/spec/models/send_template_request_language_spec.rb +42 -0
- data/spec/models/send_template_request_spec.rb +78 -0
- data/spec/models/set_whatsapp_business_encryption_request_spec.rb +36 -0
- data/spec/models/success_response_spec.rb +36 -0
- data/spec/models/update_me_request_spec.rb +72 -0
- data/spec/spec_helper.rb +111 -0
- metadata +408 -0
|
@@ -0,0 +1,1784 @@
|
|
|
1
|
+
# OneMsgChatApi::MessagingApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.1msg.io*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
| ------ | ------------ | ----------- |
|
|
7
|
+
| [**create_read_message**](MessagingApi.md#create_read_message) | **POST** /readMessage | Mark message as read |
|
|
8
|
+
| [**create_upload_media**](MessagingApi.md#create_upload_media) | **POST** /uploadMedia | Upload media |
|
|
9
|
+
| [**delete_media**](MessagingApi.md#delete_media) | **DELETE** /media/{mediaId} | Delete media from WABA storage |
|
|
10
|
+
| [**delete_media_legacy**](MessagingApi.md#delete_media_legacy) | **POST** /deleteMedia | Delete media from WABA storage (deprecated alias) |
|
|
11
|
+
| [**get_mm_lite_status**](MessagingApi.md#get_mm_lite_status) | **GET** /mmLiteStatus | Get MM Lite availability and status |
|
|
12
|
+
| [**list_messages**](MessagingApi.md#list_messages) | **GET** /messages | Get messages list |
|
|
13
|
+
| [**retrieve_media**](MessagingApi.md#retrieve_media) | **GET** /retrieveMedia | Retrieve uploaded media metadata |
|
|
14
|
+
| [**send_address_message**](MessagingApi.md#send_address_message) | **POST** /sendAddressMessage | Send address request message |
|
|
15
|
+
| [**send_button**](MessagingApi.md#send_button) | **POST** /sendButton | Send Reply Buttons Message |
|
|
16
|
+
| [**send_carousel**](MessagingApi.md#send_carousel) | **POST** /sendCarousel | Send Carousel |
|
|
17
|
+
| [**send_contact**](MessagingApi.md#send_contact) | **POST** /sendContact | Send a Contact |
|
|
18
|
+
| [**send_cta_url**](MessagingApi.md#send_cta_url) | **POST** /sendCtaUrl | Send CTA URL interactive message |
|
|
19
|
+
| [**send_file**](MessagingApi.md#send_file) | **POST** /sendFile | Send a File |
|
|
20
|
+
| [**send_flow**](MessagingApi.md#send_flow) | **POST** /sendFlow | Send WhatsApp Flow Message |
|
|
21
|
+
| [**send_list**](MessagingApi.md#send_list) | **POST** /sendList | Send List Message |
|
|
22
|
+
| [**send_location**](MessagingApi.md#send_location) | **POST** /sendLocation | Send a Location |
|
|
23
|
+
| [**send_location_request**](MessagingApi.md#send_location_request) | **POST** /sendLocationRequest | Send Location Request Message |
|
|
24
|
+
| [**send_message**](MessagingApi.md#send_message) | **POST** /sendMessage | Send a Message |
|
|
25
|
+
| [**send_order_details**](MessagingApi.md#send_order_details) | **POST** /sendOrderDetails | Send order details (India payments template) |
|
|
26
|
+
| [**send_payment_request**](MessagingApi.md#send_payment_request) | **POST** /sendPaymentRequest | Send payment request (regional) |
|
|
27
|
+
| [**send_product**](MessagingApi.md#send_product) | **POST** /sendProduct | Send a Product |
|
|
28
|
+
| [**send_reaction**](MessagingApi.md#send_reaction) | **POST** /sendReaction | Send Reaction |
|
|
29
|
+
| [**send_sticker**](MessagingApi.md#send_sticker) | **POST** /sendSticker | Send sticker message |
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## create_read_message
|
|
33
|
+
|
|
34
|
+
> <CreateReadMessage200Response> create_read_message(token, opts)
|
|
35
|
+
|
|
36
|
+
Mark message as read
|
|
37
|
+
|
|
38
|
+
### Examples
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
require 'time'
|
|
42
|
+
require 'one_msg_chat_api'
|
|
43
|
+
# setup authorization
|
|
44
|
+
OneMsgChatApi.configure do |config|
|
|
45
|
+
# Configure API key authorization: tokenAuth
|
|
46
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
47
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
48
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
52
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
53
|
+
opts = {
|
|
54
|
+
message_id: 'message_id_example', # String |
|
|
55
|
+
msg_id: 'msg_id_example', # String |
|
|
56
|
+
typing_indicator: true # Boolean | Show WhatsApp typing indicator (max 25s or until reply)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
begin
|
|
60
|
+
# Mark message as read
|
|
61
|
+
result = api_instance.create_read_message(token, opts)
|
|
62
|
+
p result
|
|
63
|
+
rescue OneMsgChatApi::ApiError => e
|
|
64
|
+
puts "Error when calling MessagingApi->create_read_message: #{e}"
|
|
65
|
+
end
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### Using the create_read_message_with_http_info variant
|
|
69
|
+
|
|
70
|
+
This returns an Array which contains the response data, status code and headers.
|
|
71
|
+
|
|
72
|
+
> <Array(<CreateReadMessage200Response>, Integer, Hash)> create_read_message_with_http_info(token, opts)
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
begin
|
|
76
|
+
# Mark message as read
|
|
77
|
+
data, status_code, headers = api_instance.create_read_message_with_http_info(token, opts)
|
|
78
|
+
p status_code # => 2xx
|
|
79
|
+
p headers # => { ... }
|
|
80
|
+
p data # => <CreateReadMessage200Response>
|
|
81
|
+
rescue OneMsgChatApi::ApiError => e
|
|
82
|
+
puts "Error when calling MessagingApi->create_read_message_with_http_info: #{e}"
|
|
83
|
+
end
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Parameters
|
|
87
|
+
|
|
88
|
+
| Name | Type | Description | Notes |
|
|
89
|
+
| ---- | ---- | ----------- | ----- |
|
|
90
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
91
|
+
| **message_id** | **String** | | [optional] |
|
|
92
|
+
| **msg_id** | **String** | | [optional] |
|
|
93
|
+
| **typing_indicator** | **Boolean** | Show WhatsApp typing indicator (max 25s or until reply) | [optional][default to false] |
|
|
94
|
+
|
|
95
|
+
### Return type
|
|
96
|
+
|
|
97
|
+
[**CreateReadMessage200Response**](CreateReadMessage200Response.md)
|
|
98
|
+
|
|
99
|
+
### Authorization
|
|
100
|
+
|
|
101
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
102
|
+
|
|
103
|
+
### HTTP request headers
|
|
104
|
+
|
|
105
|
+
- **Content-Type**: application/x-www-form-urlencoded, application/json
|
|
106
|
+
- **Accept**: application/json
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
## create_upload_media
|
|
110
|
+
|
|
111
|
+
> create_upload_media(token, opts)
|
|
112
|
+
|
|
113
|
+
Upload media
|
|
114
|
+
|
|
115
|
+
### Examples
|
|
116
|
+
|
|
117
|
+
```ruby
|
|
118
|
+
require 'time'
|
|
119
|
+
require 'one_msg_chat_api'
|
|
120
|
+
# setup authorization
|
|
121
|
+
OneMsgChatApi.configure do |config|
|
|
122
|
+
# Configure API key authorization: tokenAuth
|
|
123
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
124
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
125
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
129
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
130
|
+
opts = {
|
|
131
|
+
request_body: { key: 3.56} # Hash<String, Object> |
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
begin
|
|
135
|
+
# Upload media
|
|
136
|
+
api_instance.create_upload_media(token, opts)
|
|
137
|
+
rescue OneMsgChatApi::ApiError => e
|
|
138
|
+
puts "Error when calling MessagingApi->create_upload_media: #{e}"
|
|
139
|
+
end
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Using the create_upload_media_with_http_info variant
|
|
143
|
+
|
|
144
|
+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
|
145
|
+
|
|
146
|
+
> <Array(nil, Integer, Hash)> create_upload_media_with_http_info(token, opts)
|
|
147
|
+
|
|
148
|
+
```ruby
|
|
149
|
+
begin
|
|
150
|
+
# Upload media
|
|
151
|
+
data, status_code, headers = api_instance.create_upload_media_with_http_info(token, opts)
|
|
152
|
+
p status_code # => 2xx
|
|
153
|
+
p headers # => { ... }
|
|
154
|
+
p data # => nil
|
|
155
|
+
rescue OneMsgChatApi::ApiError => e
|
|
156
|
+
puts "Error when calling MessagingApi->create_upload_media_with_http_info: #{e}"
|
|
157
|
+
end
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Parameters
|
|
161
|
+
|
|
162
|
+
| Name | Type | Description | Notes |
|
|
163
|
+
| ---- | ---- | ----------- | ----- |
|
|
164
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
165
|
+
| **request_body** | [**Hash<String, Object>**](Object.md) | | [optional] |
|
|
166
|
+
|
|
167
|
+
### Return type
|
|
168
|
+
|
|
169
|
+
nil (empty response body)
|
|
170
|
+
|
|
171
|
+
### Authorization
|
|
172
|
+
|
|
173
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
174
|
+
|
|
175
|
+
### HTTP request headers
|
|
176
|
+
|
|
177
|
+
- **Content-Type**: application/json
|
|
178
|
+
- **Accept**: Not defined
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
## delete_media
|
|
182
|
+
|
|
183
|
+
> <SuccessResponse> delete_media(token, media_id)
|
|
184
|
+
|
|
185
|
+
Delete media from WABA storage
|
|
186
|
+
|
|
187
|
+
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.
|
|
188
|
+
|
|
189
|
+
### Examples
|
|
190
|
+
|
|
191
|
+
```ruby
|
|
192
|
+
require 'time'
|
|
193
|
+
require 'one_msg_chat_api'
|
|
194
|
+
# setup authorization
|
|
195
|
+
OneMsgChatApi.configure do |config|
|
|
196
|
+
# Configure API key authorization: tokenAuth
|
|
197
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
198
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
199
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
203
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
204
|
+
media_id = 'media_id_example' # String | Numeric WABA media id
|
|
205
|
+
|
|
206
|
+
begin
|
|
207
|
+
# Delete media from WABA storage
|
|
208
|
+
result = api_instance.delete_media(token, media_id)
|
|
209
|
+
p result
|
|
210
|
+
rescue OneMsgChatApi::ApiError => e
|
|
211
|
+
puts "Error when calling MessagingApi->delete_media: #{e}"
|
|
212
|
+
end
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### Using the delete_media_with_http_info variant
|
|
216
|
+
|
|
217
|
+
This returns an Array which contains the response data, status code and headers.
|
|
218
|
+
|
|
219
|
+
> <Array(<SuccessResponse>, Integer, Hash)> delete_media_with_http_info(token, media_id)
|
|
220
|
+
|
|
221
|
+
```ruby
|
|
222
|
+
begin
|
|
223
|
+
# Delete media from WABA storage
|
|
224
|
+
data, status_code, headers = api_instance.delete_media_with_http_info(token, media_id)
|
|
225
|
+
p status_code # => 2xx
|
|
226
|
+
p headers # => { ... }
|
|
227
|
+
p data # => <SuccessResponse>
|
|
228
|
+
rescue OneMsgChatApi::ApiError => e
|
|
229
|
+
puts "Error when calling MessagingApi->delete_media_with_http_info: #{e}"
|
|
230
|
+
end
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Parameters
|
|
234
|
+
|
|
235
|
+
| Name | Type | Description | Notes |
|
|
236
|
+
| ---- | ---- | ----------- | ----- |
|
|
237
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
238
|
+
| **media_id** | **String** | Numeric WABA media id | |
|
|
239
|
+
|
|
240
|
+
### Return type
|
|
241
|
+
|
|
242
|
+
[**SuccessResponse**](SuccessResponse.md)
|
|
243
|
+
|
|
244
|
+
### Authorization
|
|
245
|
+
|
|
246
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
247
|
+
|
|
248
|
+
### HTTP request headers
|
|
249
|
+
|
|
250
|
+
- **Content-Type**: Not defined
|
|
251
|
+
- **Accept**: application/json
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## delete_media_legacy
|
|
255
|
+
|
|
256
|
+
> <SuccessResponse> delete_media_legacy(token, delete_media_legacy_request)
|
|
257
|
+
|
|
258
|
+
Delete media from WABA storage (deprecated alias)
|
|
259
|
+
|
|
260
|
+
**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).
|
|
261
|
+
|
|
262
|
+
### Examples
|
|
263
|
+
|
|
264
|
+
```ruby
|
|
265
|
+
require 'time'
|
|
266
|
+
require 'one_msg_chat_api'
|
|
267
|
+
# setup authorization
|
|
268
|
+
OneMsgChatApi.configure do |config|
|
|
269
|
+
# Configure API key authorization: tokenAuth
|
|
270
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
271
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
272
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
276
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
277
|
+
delete_media_legacy_request = OneMsgChatApi::DeleteMediaLegacyRequest.new({media_id: 'media_id_example'}) # DeleteMediaLegacyRequest |
|
|
278
|
+
|
|
279
|
+
begin
|
|
280
|
+
# Delete media from WABA storage (deprecated alias)
|
|
281
|
+
result = api_instance.delete_media_legacy(token, delete_media_legacy_request)
|
|
282
|
+
p result
|
|
283
|
+
rescue OneMsgChatApi::ApiError => e
|
|
284
|
+
puts "Error when calling MessagingApi->delete_media_legacy: #{e}"
|
|
285
|
+
end
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
#### Using the delete_media_legacy_with_http_info variant
|
|
289
|
+
|
|
290
|
+
This returns an Array which contains the response data, status code and headers.
|
|
291
|
+
|
|
292
|
+
> <Array(<SuccessResponse>, Integer, Hash)> delete_media_legacy_with_http_info(token, delete_media_legacy_request)
|
|
293
|
+
|
|
294
|
+
```ruby
|
|
295
|
+
begin
|
|
296
|
+
# Delete media from WABA storage (deprecated alias)
|
|
297
|
+
data, status_code, headers = api_instance.delete_media_legacy_with_http_info(token, delete_media_legacy_request)
|
|
298
|
+
p status_code # => 2xx
|
|
299
|
+
p headers # => { ... }
|
|
300
|
+
p data # => <SuccessResponse>
|
|
301
|
+
rescue OneMsgChatApi::ApiError => e
|
|
302
|
+
puts "Error when calling MessagingApi->delete_media_legacy_with_http_info: #{e}"
|
|
303
|
+
end
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Parameters
|
|
307
|
+
|
|
308
|
+
| Name | Type | Description | Notes |
|
|
309
|
+
| ---- | ---- | ----------- | ----- |
|
|
310
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
311
|
+
| **delete_media_legacy_request** | [**DeleteMediaLegacyRequest**](DeleteMediaLegacyRequest.md) | | |
|
|
312
|
+
|
|
313
|
+
### Return type
|
|
314
|
+
|
|
315
|
+
[**SuccessResponse**](SuccessResponse.md)
|
|
316
|
+
|
|
317
|
+
### Authorization
|
|
318
|
+
|
|
319
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
320
|
+
|
|
321
|
+
### HTTP request headers
|
|
322
|
+
|
|
323
|
+
- **Content-Type**: application/json
|
|
324
|
+
- **Accept**: application/json
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
## get_mm_lite_status
|
|
328
|
+
|
|
329
|
+
> <GetMmLiteStatus200Response> get_mm_lite_status(token)
|
|
330
|
+
|
|
331
|
+
Get MM Lite availability and status
|
|
332
|
+
|
|
333
|
+
### Examples
|
|
334
|
+
|
|
335
|
+
```ruby
|
|
336
|
+
require 'time'
|
|
337
|
+
require 'one_msg_chat_api'
|
|
338
|
+
# setup authorization
|
|
339
|
+
OneMsgChatApi.configure do |config|
|
|
340
|
+
# Configure API key authorization: tokenAuth
|
|
341
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
342
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
343
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
347
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
348
|
+
|
|
349
|
+
begin
|
|
350
|
+
# Get MM Lite availability and status
|
|
351
|
+
result = api_instance.get_mm_lite_status(token)
|
|
352
|
+
p result
|
|
353
|
+
rescue OneMsgChatApi::ApiError => e
|
|
354
|
+
puts "Error when calling MessagingApi->get_mm_lite_status: #{e}"
|
|
355
|
+
end
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### Using the get_mm_lite_status_with_http_info variant
|
|
359
|
+
|
|
360
|
+
This returns an Array which contains the response data, status code and headers.
|
|
361
|
+
|
|
362
|
+
> <Array(<GetMmLiteStatus200Response>, Integer, Hash)> get_mm_lite_status_with_http_info(token)
|
|
363
|
+
|
|
364
|
+
```ruby
|
|
365
|
+
begin
|
|
366
|
+
# Get MM Lite availability and status
|
|
367
|
+
data, status_code, headers = api_instance.get_mm_lite_status_with_http_info(token)
|
|
368
|
+
p status_code # => 2xx
|
|
369
|
+
p headers # => { ... }
|
|
370
|
+
p data # => <GetMmLiteStatus200Response>
|
|
371
|
+
rescue OneMsgChatApi::ApiError => e
|
|
372
|
+
puts "Error when calling MessagingApi->get_mm_lite_status_with_http_info: #{e}"
|
|
373
|
+
end
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Parameters
|
|
377
|
+
|
|
378
|
+
| Name | Type | Description | Notes |
|
|
379
|
+
| ---- | ---- | ----------- | ----- |
|
|
380
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
381
|
+
|
|
382
|
+
### Return type
|
|
383
|
+
|
|
384
|
+
[**GetMmLiteStatus200Response**](GetMmLiteStatus200Response.md)
|
|
385
|
+
|
|
386
|
+
### Authorization
|
|
387
|
+
|
|
388
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
389
|
+
|
|
390
|
+
### HTTP request headers
|
|
391
|
+
|
|
392
|
+
- **Content-Type**: Not defined
|
|
393
|
+
- **Accept**: application/json
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
## list_messages
|
|
397
|
+
|
|
398
|
+
> <ListMessages200Response> list_messages(token)
|
|
399
|
+
|
|
400
|
+
Get messages list
|
|
401
|
+
|
|
402
|
+
### Examples
|
|
403
|
+
|
|
404
|
+
```ruby
|
|
405
|
+
require 'time'
|
|
406
|
+
require 'one_msg_chat_api'
|
|
407
|
+
# setup authorization
|
|
408
|
+
OneMsgChatApi.configure do |config|
|
|
409
|
+
# Configure API key authorization: tokenAuth
|
|
410
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
411
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
412
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
416
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
417
|
+
|
|
418
|
+
begin
|
|
419
|
+
# Get messages list
|
|
420
|
+
result = api_instance.list_messages(token)
|
|
421
|
+
p result
|
|
422
|
+
rescue OneMsgChatApi::ApiError => e
|
|
423
|
+
puts "Error when calling MessagingApi->list_messages: #{e}"
|
|
424
|
+
end
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
#### Using the list_messages_with_http_info variant
|
|
428
|
+
|
|
429
|
+
This returns an Array which contains the response data, status code and headers.
|
|
430
|
+
|
|
431
|
+
> <Array(<ListMessages200Response>, Integer, Hash)> list_messages_with_http_info(token)
|
|
432
|
+
|
|
433
|
+
```ruby
|
|
434
|
+
begin
|
|
435
|
+
# Get messages list
|
|
436
|
+
data, status_code, headers = api_instance.list_messages_with_http_info(token)
|
|
437
|
+
p status_code # => 2xx
|
|
438
|
+
p headers # => { ... }
|
|
439
|
+
p data # => <ListMessages200Response>
|
|
440
|
+
rescue OneMsgChatApi::ApiError => e
|
|
441
|
+
puts "Error when calling MessagingApi->list_messages_with_http_info: #{e}"
|
|
442
|
+
end
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Parameters
|
|
446
|
+
|
|
447
|
+
| Name | Type | Description | Notes |
|
|
448
|
+
| ---- | ---- | ----------- | ----- |
|
|
449
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
450
|
+
|
|
451
|
+
### Return type
|
|
452
|
+
|
|
453
|
+
[**ListMessages200Response**](ListMessages200Response.md)
|
|
454
|
+
|
|
455
|
+
### Authorization
|
|
456
|
+
|
|
457
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
458
|
+
|
|
459
|
+
### HTTP request headers
|
|
460
|
+
|
|
461
|
+
- **Content-Type**: Not defined
|
|
462
|
+
- **Accept**: application/json
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
## retrieve_media
|
|
466
|
+
|
|
467
|
+
> <RetrieveMedia200Response> retrieve_media(token, media_id)
|
|
468
|
+
|
|
469
|
+
Retrieve uploaded media metadata
|
|
470
|
+
|
|
471
|
+
Get WABA media URL and metadata by mediaId (from uploadMedia). The returned `url` is temporary and typically expires within ~5 minutes.
|
|
472
|
+
|
|
473
|
+
### Examples
|
|
474
|
+
|
|
475
|
+
```ruby
|
|
476
|
+
require 'time'
|
|
477
|
+
require 'one_msg_chat_api'
|
|
478
|
+
# setup authorization
|
|
479
|
+
OneMsgChatApi.configure do |config|
|
|
480
|
+
# Configure API key authorization: tokenAuth
|
|
481
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
482
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
483
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
487
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
488
|
+
media_id = 'media_id_example' # String |
|
|
489
|
+
|
|
490
|
+
begin
|
|
491
|
+
# Retrieve uploaded media metadata
|
|
492
|
+
result = api_instance.retrieve_media(token, media_id)
|
|
493
|
+
p result
|
|
494
|
+
rescue OneMsgChatApi::ApiError => e
|
|
495
|
+
puts "Error when calling MessagingApi->retrieve_media: #{e}"
|
|
496
|
+
end
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
#### Using the retrieve_media_with_http_info variant
|
|
500
|
+
|
|
501
|
+
This returns an Array which contains the response data, status code and headers.
|
|
502
|
+
|
|
503
|
+
> <Array(<RetrieveMedia200Response>, Integer, Hash)> retrieve_media_with_http_info(token, media_id)
|
|
504
|
+
|
|
505
|
+
```ruby
|
|
506
|
+
begin
|
|
507
|
+
# Retrieve uploaded media metadata
|
|
508
|
+
data, status_code, headers = api_instance.retrieve_media_with_http_info(token, media_id)
|
|
509
|
+
p status_code # => 2xx
|
|
510
|
+
p headers # => { ... }
|
|
511
|
+
p data # => <RetrieveMedia200Response>
|
|
512
|
+
rescue OneMsgChatApi::ApiError => e
|
|
513
|
+
puts "Error when calling MessagingApi->retrieve_media_with_http_info: #{e}"
|
|
514
|
+
end
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Parameters
|
|
518
|
+
|
|
519
|
+
| Name | Type | Description | Notes |
|
|
520
|
+
| ---- | ---- | ----------- | ----- |
|
|
521
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
522
|
+
| **media_id** | **String** | | |
|
|
523
|
+
|
|
524
|
+
### Return type
|
|
525
|
+
|
|
526
|
+
[**RetrieveMedia200Response**](RetrieveMedia200Response.md)
|
|
527
|
+
|
|
528
|
+
### Authorization
|
|
529
|
+
|
|
530
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
531
|
+
|
|
532
|
+
### HTTP request headers
|
|
533
|
+
|
|
534
|
+
- **Content-Type**: Not defined
|
|
535
|
+
- **Accept**: application/json
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
## send_address_message
|
|
539
|
+
|
|
540
|
+
> <MessageSentResponse> send_address_message(token, send_address_message_request)
|
|
541
|
+
|
|
542
|
+
Send address request message
|
|
543
|
+
|
|
544
|
+
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`.
|
|
545
|
+
|
|
546
|
+
### Examples
|
|
547
|
+
|
|
548
|
+
```ruby
|
|
549
|
+
require 'time'
|
|
550
|
+
require 'one_msg_chat_api'
|
|
551
|
+
# setup authorization
|
|
552
|
+
OneMsgChatApi.configure do |config|
|
|
553
|
+
# Configure API key authorization: tokenAuth
|
|
554
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
555
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
556
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
560
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
561
|
+
send_address_message_request = OneMsgChatApi::SendAddressMessageRequest.new({body: 'body_example'}) # SendAddressMessageRequest |
|
|
562
|
+
|
|
563
|
+
begin
|
|
564
|
+
# Send address request message
|
|
565
|
+
result = api_instance.send_address_message(token, send_address_message_request)
|
|
566
|
+
p result
|
|
567
|
+
rescue OneMsgChatApi::ApiError => e
|
|
568
|
+
puts "Error when calling MessagingApi->send_address_message: #{e}"
|
|
569
|
+
end
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
#### Using the send_address_message_with_http_info variant
|
|
573
|
+
|
|
574
|
+
This returns an Array which contains the response data, status code and headers.
|
|
575
|
+
|
|
576
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_address_message_with_http_info(token, send_address_message_request)
|
|
577
|
+
|
|
578
|
+
```ruby
|
|
579
|
+
begin
|
|
580
|
+
# Send address request message
|
|
581
|
+
data, status_code, headers = api_instance.send_address_message_with_http_info(token, send_address_message_request)
|
|
582
|
+
p status_code # => 2xx
|
|
583
|
+
p headers # => { ... }
|
|
584
|
+
p data # => <MessageSentResponse>
|
|
585
|
+
rescue OneMsgChatApi::ApiError => e
|
|
586
|
+
puts "Error when calling MessagingApi->send_address_message_with_http_info: #{e}"
|
|
587
|
+
end
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### Parameters
|
|
591
|
+
|
|
592
|
+
| Name | Type | Description | Notes |
|
|
593
|
+
| ---- | ---- | ----------- | ----- |
|
|
594
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
595
|
+
| **send_address_message_request** | [**SendAddressMessageRequest**](SendAddressMessageRequest.md) | | |
|
|
596
|
+
|
|
597
|
+
### Return type
|
|
598
|
+
|
|
599
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
600
|
+
|
|
601
|
+
### Authorization
|
|
602
|
+
|
|
603
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
604
|
+
|
|
605
|
+
### HTTP request headers
|
|
606
|
+
|
|
607
|
+
- **Content-Type**: application/json
|
|
608
|
+
- **Accept**: application/json
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
## send_button
|
|
612
|
+
|
|
613
|
+
> <MessageSentResponse> send_button(token, opts)
|
|
614
|
+
|
|
615
|
+
Send Reply Buttons Message
|
|
616
|
+
|
|
617
|
+
### Examples
|
|
618
|
+
|
|
619
|
+
```ruby
|
|
620
|
+
require 'time'
|
|
621
|
+
require 'one_msg_chat_api'
|
|
622
|
+
# setup authorization
|
|
623
|
+
OneMsgChatApi.configure do |config|
|
|
624
|
+
# Configure API key authorization: tokenAuth
|
|
625
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
626
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
627
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
631
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
632
|
+
opts = {
|
|
633
|
+
send_button_request: OneMsgChatApi::SendButtonRequest.new # SendButtonRequest |
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
begin
|
|
637
|
+
# Send Reply Buttons Message
|
|
638
|
+
result = api_instance.send_button(token, opts)
|
|
639
|
+
p result
|
|
640
|
+
rescue OneMsgChatApi::ApiError => e
|
|
641
|
+
puts "Error when calling MessagingApi->send_button: #{e}"
|
|
642
|
+
end
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
#### Using the send_button_with_http_info variant
|
|
646
|
+
|
|
647
|
+
This returns an Array which contains the response data, status code and headers.
|
|
648
|
+
|
|
649
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_button_with_http_info(token, opts)
|
|
650
|
+
|
|
651
|
+
```ruby
|
|
652
|
+
begin
|
|
653
|
+
# Send Reply Buttons Message
|
|
654
|
+
data, status_code, headers = api_instance.send_button_with_http_info(token, opts)
|
|
655
|
+
p status_code # => 2xx
|
|
656
|
+
p headers # => { ... }
|
|
657
|
+
p data # => <MessageSentResponse>
|
|
658
|
+
rescue OneMsgChatApi::ApiError => e
|
|
659
|
+
puts "Error when calling MessagingApi->send_button_with_http_info: #{e}"
|
|
660
|
+
end
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
### Parameters
|
|
664
|
+
|
|
665
|
+
| Name | Type | Description | Notes |
|
|
666
|
+
| ---- | ---- | ----------- | ----- |
|
|
667
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
668
|
+
| **send_button_request** | [**SendButtonRequest**](SendButtonRequest.md) | | [optional] |
|
|
669
|
+
|
|
670
|
+
### Return type
|
|
671
|
+
|
|
672
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
673
|
+
|
|
674
|
+
### Authorization
|
|
675
|
+
|
|
676
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
677
|
+
|
|
678
|
+
### HTTP request headers
|
|
679
|
+
|
|
680
|
+
- **Content-Type**: application/json
|
|
681
|
+
- **Accept**: application/json
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
## send_carousel
|
|
685
|
+
|
|
686
|
+
> <MessageSentResponse> send_carousel(token, params, opts)
|
|
687
|
+
|
|
688
|
+
Send Carousel
|
|
689
|
+
|
|
690
|
+
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.
|
|
691
|
+
|
|
692
|
+
### Examples
|
|
693
|
+
|
|
694
|
+
```ruby
|
|
695
|
+
require 'time'
|
|
696
|
+
require 'one_msg_chat_api'
|
|
697
|
+
# setup authorization
|
|
698
|
+
OneMsgChatApi.configure do |config|
|
|
699
|
+
# Configure API key authorization: tokenAuth
|
|
700
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
701
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
702
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
703
|
+
end
|
|
704
|
+
|
|
705
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
706
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
707
|
+
params = [3.56] # Array<Object> | Required. Template-like structure (same as sendTemplate params). Must include a CAROUSEL component and its cards. Structure: - params[] item with type CAROUSEL and cards (2..10) - cards[] item: - components[] items: - header: parameters[0] with type image/video/product - image: {\\\"image\\\": {\\\"link\\\": \\\"https://...\\\"}} - video: {\\\"video\\\": {\\\"link\\\": \\\"https://...\\\"}} - product: {\\\"product\\\": {\\\"catalog_id\\\": \\\"...\\\", \\\"product_retailer_id\\\": \\\"...\\\"}} - button: sub_type url or quick_reply - url: parameters {\\\"text\\\": \\\"Button\\\", \\\"url\\\": \\\"https://...\\\"} - quick_reply: parameters[] of {\\\"id\\\": \\\"...\\\", \\\"text\\\": \\\"...\\\"}
|
|
708
|
+
opts = {
|
|
709
|
+
body: 'body_example', # String | Text shown above the carousel. Optional. If omitted and params include a body component, the body will be taken from params.
|
|
710
|
+
quoted_msg_id: 'quoted_msg_id_example', # String | Quoted message ID (Cloud API)
|
|
711
|
+
chat_id: 'chat_id_example', # String | Required if phone is not set. Chat ID from the message list. Examples: 12020721369@c.us or 120363046942338209@g.us(group)
|
|
712
|
+
phone: 56 # Integer | Required if chatId is not set. A phone number starting with the country code. USA example: 12020721369.
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
begin
|
|
716
|
+
# Send Carousel
|
|
717
|
+
result = api_instance.send_carousel(token, params, opts)
|
|
718
|
+
p result
|
|
719
|
+
rescue OneMsgChatApi::ApiError => e
|
|
720
|
+
puts "Error when calling MessagingApi->send_carousel: #{e}"
|
|
721
|
+
end
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
#### Using the send_carousel_with_http_info variant
|
|
725
|
+
|
|
726
|
+
This returns an Array which contains the response data, status code and headers.
|
|
727
|
+
|
|
728
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_carousel_with_http_info(token, params, opts)
|
|
729
|
+
|
|
730
|
+
```ruby
|
|
731
|
+
begin
|
|
732
|
+
# Send Carousel
|
|
733
|
+
data, status_code, headers = api_instance.send_carousel_with_http_info(token, params, opts)
|
|
734
|
+
p status_code # => 2xx
|
|
735
|
+
p headers # => { ... }
|
|
736
|
+
p data # => <MessageSentResponse>
|
|
737
|
+
rescue OneMsgChatApi::ApiError => e
|
|
738
|
+
puts "Error when calling MessagingApi->send_carousel_with_http_info: #{e}"
|
|
739
|
+
end
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
### Parameters
|
|
743
|
+
|
|
744
|
+
| Name | Type | Description | Notes |
|
|
745
|
+
| ---- | ---- | ----------- | ----- |
|
|
746
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
747
|
+
| **params** | [**Array<Object>**](Object.md) | Required. Template-like structure (same as sendTemplate params). Must include a CAROUSEL component and its cards. Structure: - params[] item with type CAROUSEL and cards (2..10) - cards[] item: - components[] items: - header: parameters[0] with type image/video/product - image: {\\\"image\\\": {\\\"link\\\": \\\"https://...\\\"}} - video: {\\\"video\\\": {\\\"link\\\": \\\"https://...\\\"}} - product: {\\\"product\\\": {\\\"catalog_id\\\": \\\"...\\\", \\\"product_retailer_id\\\": \\\"...\\\"}} - button: sub_type url or quick_reply - url: parameters {\\\"text\\\": \\\"Button\\\", \\\"url\\\": \\\"https://...\\\"} - quick_reply: parameters[] of {\\\"id\\\": \\\"...\\\", \\\"text\\\": \\\"...\\\"} | |
|
|
748
|
+
| **body** | **String** | Text shown above the carousel. Optional. If omitted and params include a body component, the body will be taken from params. | [optional] |
|
|
749
|
+
| **quoted_msg_id** | **String** | Quoted message ID (Cloud API) | [optional] |
|
|
750
|
+
| **chat_id** | **String** | Required if phone is not set. Chat ID from the message list. Examples: 12020721369@c.us or 120363046942338209@g.us(group) | [optional] |
|
|
751
|
+
| **phone** | **Integer** | Required if chatId is not set. A phone number starting with the country code. USA example: 12020721369. | [optional] |
|
|
752
|
+
|
|
753
|
+
### Return type
|
|
754
|
+
|
|
755
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
756
|
+
|
|
757
|
+
### Authorization
|
|
758
|
+
|
|
759
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
760
|
+
|
|
761
|
+
### HTTP request headers
|
|
762
|
+
|
|
763
|
+
- **Content-Type**: application/x-www-form-urlencoded, application/json
|
|
764
|
+
- **Accept**: application/json
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
## send_contact
|
|
768
|
+
|
|
769
|
+
> <MessageSentResponse> send_contact(token, opts)
|
|
770
|
+
|
|
771
|
+
Send a Contact
|
|
772
|
+
|
|
773
|
+
### Examples
|
|
774
|
+
|
|
775
|
+
```ruby
|
|
776
|
+
require 'time'
|
|
777
|
+
require 'one_msg_chat_api'
|
|
778
|
+
# setup authorization
|
|
779
|
+
OneMsgChatApi.configure do |config|
|
|
780
|
+
# Configure API key authorization: tokenAuth
|
|
781
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
782
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
783
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
784
|
+
end
|
|
785
|
+
|
|
786
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
787
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
788
|
+
opts = {
|
|
789
|
+
send_contact_request: OneMsgChatApi::SendContactRequest.new # SendContactRequest |
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
begin
|
|
793
|
+
# Send a Contact
|
|
794
|
+
result = api_instance.send_contact(token, opts)
|
|
795
|
+
p result
|
|
796
|
+
rescue OneMsgChatApi::ApiError => e
|
|
797
|
+
puts "Error when calling MessagingApi->send_contact: #{e}"
|
|
798
|
+
end
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
#### Using the send_contact_with_http_info variant
|
|
802
|
+
|
|
803
|
+
This returns an Array which contains the response data, status code and headers.
|
|
804
|
+
|
|
805
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_contact_with_http_info(token, opts)
|
|
806
|
+
|
|
807
|
+
```ruby
|
|
808
|
+
begin
|
|
809
|
+
# Send a Contact
|
|
810
|
+
data, status_code, headers = api_instance.send_contact_with_http_info(token, opts)
|
|
811
|
+
p status_code # => 2xx
|
|
812
|
+
p headers # => { ... }
|
|
813
|
+
p data # => <MessageSentResponse>
|
|
814
|
+
rescue OneMsgChatApi::ApiError => e
|
|
815
|
+
puts "Error when calling MessagingApi->send_contact_with_http_info: #{e}"
|
|
816
|
+
end
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
### Parameters
|
|
820
|
+
|
|
821
|
+
| Name | Type | Description | Notes |
|
|
822
|
+
| ---- | ---- | ----------- | ----- |
|
|
823
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
824
|
+
| **send_contact_request** | [**SendContactRequest**](SendContactRequest.md) | | [optional] |
|
|
825
|
+
|
|
826
|
+
### Return type
|
|
827
|
+
|
|
828
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
829
|
+
|
|
830
|
+
### Authorization
|
|
831
|
+
|
|
832
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
833
|
+
|
|
834
|
+
### HTTP request headers
|
|
835
|
+
|
|
836
|
+
- **Content-Type**: application/json
|
|
837
|
+
- **Accept**: application/json
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
## send_cta_url
|
|
841
|
+
|
|
842
|
+
> <MessageSentResponse> send_cta_url(token, send_cta_url_request)
|
|
843
|
+
|
|
844
|
+
Send CTA URL interactive message
|
|
845
|
+
|
|
846
|
+
Send an interactive message with a single call-to-action URL button.
|
|
847
|
+
|
|
848
|
+
### Examples
|
|
849
|
+
|
|
850
|
+
```ruby
|
|
851
|
+
require 'time'
|
|
852
|
+
require 'one_msg_chat_api'
|
|
853
|
+
# setup authorization
|
|
854
|
+
OneMsgChatApi.configure do |config|
|
|
855
|
+
# Configure API key authorization: tokenAuth
|
|
856
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
857
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
858
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
859
|
+
end
|
|
860
|
+
|
|
861
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
862
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
863
|
+
send_cta_url_request = OneMsgChatApi::SendCtaUrlRequest.new({body: 'body_example', display_text: 'display_text_example', url: 'url_example'}) # SendCtaUrlRequest |
|
|
864
|
+
|
|
865
|
+
begin
|
|
866
|
+
# Send CTA URL interactive message
|
|
867
|
+
result = api_instance.send_cta_url(token, send_cta_url_request)
|
|
868
|
+
p result
|
|
869
|
+
rescue OneMsgChatApi::ApiError => e
|
|
870
|
+
puts "Error when calling MessagingApi->send_cta_url: #{e}"
|
|
871
|
+
end
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
#### Using the send_cta_url_with_http_info variant
|
|
875
|
+
|
|
876
|
+
This returns an Array which contains the response data, status code and headers.
|
|
877
|
+
|
|
878
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_cta_url_with_http_info(token, send_cta_url_request)
|
|
879
|
+
|
|
880
|
+
```ruby
|
|
881
|
+
begin
|
|
882
|
+
# Send CTA URL interactive message
|
|
883
|
+
data, status_code, headers = api_instance.send_cta_url_with_http_info(token, send_cta_url_request)
|
|
884
|
+
p status_code # => 2xx
|
|
885
|
+
p headers # => { ... }
|
|
886
|
+
p data # => <MessageSentResponse>
|
|
887
|
+
rescue OneMsgChatApi::ApiError => e
|
|
888
|
+
puts "Error when calling MessagingApi->send_cta_url_with_http_info: #{e}"
|
|
889
|
+
end
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
### Parameters
|
|
893
|
+
|
|
894
|
+
| Name | Type | Description | Notes |
|
|
895
|
+
| ---- | ---- | ----------- | ----- |
|
|
896
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
897
|
+
| **send_cta_url_request** | [**SendCtaUrlRequest**](SendCtaUrlRequest.md) | | |
|
|
898
|
+
|
|
899
|
+
### Return type
|
|
900
|
+
|
|
901
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
902
|
+
|
|
903
|
+
### Authorization
|
|
904
|
+
|
|
905
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
906
|
+
|
|
907
|
+
### HTTP request headers
|
|
908
|
+
|
|
909
|
+
- **Content-Type**: application/json
|
|
910
|
+
- **Accept**: application/json
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
## send_file
|
|
914
|
+
|
|
915
|
+
> <MessageSentResponse> send_file(token, opts)
|
|
916
|
+
|
|
917
|
+
Send a File
|
|
918
|
+
|
|
919
|
+
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.
|
|
920
|
+
|
|
921
|
+
### Examples
|
|
922
|
+
|
|
923
|
+
```ruby
|
|
924
|
+
require 'time'
|
|
925
|
+
require 'one_msg_chat_api'
|
|
926
|
+
# setup authorization
|
|
927
|
+
OneMsgChatApi.configure do |config|
|
|
928
|
+
# Configure API key authorization: tokenAuth
|
|
929
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
930
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
931
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
935
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
936
|
+
opts = {
|
|
937
|
+
body: 'body_example', # String | File source (required unless mediaId is set): - HTTP/HTTPS URL - Base64 data URI
|
|
938
|
+
filename: 'filename_example', # String | File name with extension (required with body, not with mediaId)
|
|
939
|
+
media_id: 'media_id_example', # String | WABA media id from uploadMedia (alternative to body)
|
|
940
|
+
media_type: 'image', # String | Required when using mediaId
|
|
941
|
+
voice: true, # Boolean | Native WhatsApp voice note (audio/ogg only)
|
|
942
|
+
caption: 'caption_example', # String |
|
|
943
|
+
quoted_msg_id: 'quoted_msg_id_example', # String |
|
|
944
|
+
chat_id: 'chat_id_example', # String |
|
|
945
|
+
phone: 56 # Integer |
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
begin
|
|
949
|
+
# Send a File
|
|
950
|
+
result = api_instance.send_file(token, opts)
|
|
951
|
+
p result
|
|
952
|
+
rescue OneMsgChatApi::ApiError => e
|
|
953
|
+
puts "Error when calling MessagingApi->send_file: #{e}"
|
|
954
|
+
end
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
#### Using the send_file_with_http_info variant
|
|
958
|
+
|
|
959
|
+
This returns an Array which contains the response data, status code and headers.
|
|
960
|
+
|
|
961
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_file_with_http_info(token, opts)
|
|
962
|
+
|
|
963
|
+
```ruby
|
|
964
|
+
begin
|
|
965
|
+
# Send a File
|
|
966
|
+
data, status_code, headers = api_instance.send_file_with_http_info(token, opts)
|
|
967
|
+
p status_code # => 2xx
|
|
968
|
+
p headers # => { ... }
|
|
969
|
+
p data # => <MessageSentResponse>
|
|
970
|
+
rescue OneMsgChatApi::ApiError => e
|
|
971
|
+
puts "Error when calling MessagingApi->send_file_with_http_info: #{e}"
|
|
972
|
+
end
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
### Parameters
|
|
976
|
+
|
|
977
|
+
| Name | Type | Description | Notes |
|
|
978
|
+
| ---- | ---- | ----------- | ----- |
|
|
979
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
980
|
+
| **body** | **String** | File source (required unless mediaId is set): - HTTP/HTTPS URL - Base64 data URI | [optional] |
|
|
981
|
+
| **filename** | **String** | File name with extension (required with body, not with mediaId) | [optional] |
|
|
982
|
+
| **media_id** | **String** | WABA media id from uploadMedia (alternative to body) | [optional] |
|
|
983
|
+
| **media_type** | **String** | Required when using mediaId | [optional] |
|
|
984
|
+
| **voice** | **Boolean** | Native WhatsApp voice note (audio/ogg only) | [optional] |
|
|
985
|
+
| **caption** | **String** | | [optional] |
|
|
986
|
+
| **quoted_msg_id** | **String** | | [optional] |
|
|
987
|
+
| **chat_id** | **String** | | [optional] |
|
|
988
|
+
| **phone** | **Integer** | | [optional] |
|
|
989
|
+
|
|
990
|
+
### Return type
|
|
991
|
+
|
|
992
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
993
|
+
|
|
994
|
+
### Authorization
|
|
995
|
+
|
|
996
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
997
|
+
|
|
998
|
+
### HTTP request headers
|
|
999
|
+
|
|
1000
|
+
- **Content-Type**: application/x-www-form-urlencoded, application/json
|
|
1001
|
+
- **Accept**: application/json
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
## send_flow
|
|
1005
|
+
|
|
1006
|
+
> <MessageSentResponse> send_flow(token, body, flow_id, flow_token, flow_cta, opts)
|
|
1007
|
+
|
|
1008
|
+
Send WhatsApp Flow Message
|
|
1009
|
+
|
|
1010
|
+
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.
|
|
1011
|
+
|
|
1012
|
+
### Examples
|
|
1013
|
+
|
|
1014
|
+
```ruby
|
|
1015
|
+
require 'time'
|
|
1016
|
+
require 'one_msg_chat_api'
|
|
1017
|
+
# setup authorization
|
|
1018
|
+
OneMsgChatApi.configure do |config|
|
|
1019
|
+
# Configure API key authorization: tokenAuth
|
|
1020
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1021
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1022
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1023
|
+
end
|
|
1024
|
+
|
|
1025
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1026
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1027
|
+
body = 'body_example' # String | Flow message body text
|
|
1028
|
+
flow_id = 'flow_id_example' # String | Published Flow ID
|
|
1029
|
+
flow_token = 'flow_token_example' # String | Flow token generated by the business
|
|
1030
|
+
flow_cta = 'flow_cta_example' # String | CTA button text
|
|
1031
|
+
opts = {
|
|
1032
|
+
header: nil, # SendFlowRequestHeader |
|
|
1033
|
+
footer: 'footer_example', # String | Footer text
|
|
1034
|
+
flow_action: 'navigate', # String | Flow action type
|
|
1035
|
+
flow_action_payload: { ... }, # Object | Required for flowAction=navigate (screen is required). Ignored for data_exchange. If data is provided, it must be a non-empty object.
|
|
1036
|
+
flow_message_version: 'flow_message_version_example', # String | Flow message version (default \\\"3\\\")
|
|
1037
|
+
mode: 'draft', # String | Flow mode (draft or published). If omitted, provider default applies
|
|
1038
|
+
flow_action_data: { ... }, # Object | Shortcut for flowActionPayload.data (optional)
|
|
1039
|
+
flow_action_screen: 'flow_action_screen_example', # String | Shortcut for flowActionPayload.screen (optional)
|
|
1040
|
+
quoted_msg_id: 'quoted_msg_id_example', # String | Quoted message ID (Cloud API)
|
|
1041
|
+
chat_id: 'chat_id_example', # String | Required if phone is not set. Chat ID from the message list. Examples: 12020721369@c.us or 120363046942338209@g.us(group)
|
|
1042
|
+
phone: 56 # Integer | Required if chatId is not set. A phone number starting with the country code. USA example: 12020721369.
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
begin
|
|
1046
|
+
# Send WhatsApp Flow Message
|
|
1047
|
+
result = api_instance.send_flow(token, body, flow_id, flow_token, flow_cta, opts)
|
|
1048
|
+
p result
|
|
1049
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1050
|
+
puts "Error when calling MessagingApi->send_flow: #{e}"
|
|
1051
|
+
end
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
#### Using the send_flow_with_http_info variant
|
|
1055
|
+
|
|
1056
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1057
|
+
|
|
1058
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_flow_with_http_info(token, body, flow_id, flow_token, flow_cta, opts)
|
|
1059
|
+
|
|
1060
|
+
```ruby
|
|
1061
|
+
begin
|
|
1062
|
+
# Send WhatsApp Flow Message
|
|
1063
|
+
data, status_code, headers = api_instance.send_flow_with_http_info(token, body, flow_id, flow_token, flow_cta, opts)
|
|
1064
|
+
p status_code # => 2xx
|
|
1065
|
+
p headers # => { ... }
|
|
1066
|
+
p data # => <MessageSentResponse>
|
|
1067
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1068
|
+
puts "Error when calling MessagingApi->send_flow_with_http_info: #{e}"
|
|
1069
|
+
end
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
### Parameters
|
|
1073
|
+
|
|
1074
|
+
| Name | Type | Description | Notes |
|
|
1075
|
+
| ---- | ---- | ----------- | ----- |
|
|
1076
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1077
|
+
| **body** | **String** | Flow message body text | |
|
|
1078
|
+
| **flow_id** | **String** | Published Flow ID | |
|
|
1079
|
+
| **flow_token** | **String** | Flow token generated by the business | |
|
|
1080
|
+
| **flow_cta** | **String** | CTA button text | |
|
|
1081
|
+
| **header** | [**SendFlowRequestHeader**](SendFlowRequestHeader.md) | | [optional] |
|
|
1082
|
+
| **footer** | **String** | Footer text | [optional] |
|
|
1083
|
+
| **flow_action** | **String** | Flow action type | [optional] |
|
|
1084
|
+
| **flow_action_payload** | [**Object**](Object.md) | Required for flowAction=navigate (screen is required). Ignored for data_exchange. If data is provided, it must be a non-empty object. | [optional] |
|
|
1085
|
+
| **flow_message_version** | **String** | Flow message version (default \\\"3\\\") | [optional] |
|
|
1086
|
+
| **mode** | **String** | Flow mode (draft or published). If omitted, provider default applies | [optional] |
|
|
1087
|
+
| **flow_action_data** | [**Object**](Object.md) | Shortcut for flowActionPayload.data (optional) | [optional] |
|
|
1088
|
+
| **flow_action_screen** | **String** | Shortcut for flowActionPayload.screen (optional) | [optional] |
|
|
1089
|
+
| **quoted_msg_id** | **String** | Quoted message ID (Cloud API) | [optional] |
|
|
1090
|
+
| **chat_id** | **String** | Required if phone is not set. Chat ID from the message list. Examples: 12020721369@c.us or 120363046942338209@g.us(group) | [optional] |
|
|
1091
|
+
| **phone** | **Integer** | Required if chatId is not set. A phone number starting with the country code. USA example: 12020721369. | [optional] |
|
|
1092
|
+
|
|
1093
|
+
### Return type
|
|
1094
|
+
|
|
1095
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1096
|
+
|
|
1097
|
+
### Authorization
|
|
1098
|
+
|
|
1099
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1100
|
+
|
|
1101
|
+
### HTTP request headers
|
|
1102
|
+
|
|
1103
|
+
- **Content-Type**: application/x-www-form-urlencoded, application/json
|
|
1104
|
+
- **Accept**: application/json
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
## send_list
|
|
1108
|
+
|
|
1109
|
+
> <MessageSentResponse> send_list(token, opts)
|
|
1110
|
+
|
|
1111
|
+
Send List Message
|
|
1112
|
+
|
|
1113
|
+
### Examples
|
|
1114
|
+
|
|
1115
|
+
```ruby
|
|
1116
|
+
require 'time'
|
|
1117
|
+
require 'one_msg_chat_api'
|
|
1118
|
+
# setup authorization
|
|
1119
|
+
OneMsgChatApi.configure do |config|
|
|
1120
|
+
# Configure API key authorization: tokenAuth
|
|
1121
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1122
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1123
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1124
|
+
end
|
|
1125
|
+
|
|
1126
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1127
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1128
|
+
opts = {
|
|
1129
|
+
send_list_request: OneMsgChatApi::SendListRequest.new # SendListRequest |
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
begin
|
|
1133
|
+
# Send List Message
|
|
1134
|
+
result = api_instance.send_list(token, opts)
|
|
1135
|
+
p result
|
|
1136
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1137
|
+
puts "Error when calling MessagingApi->send_list: #{e}"
|
|
1138
|
+
end
|
|
1139
|
+
```
|
|
1140
|
+
|
|
1141
|
+
#### Using the send_list_with_http_info variant
|
|
1142
|
+
|
|
1143
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1144
|
+
|
|
1145
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_list_with_http_info(token, opts)
|
|
1146
|
+
|
|
1147
|
+
```ruby
|
|
1148
|
+
begin
|
|
1149
|
+
# Send List Message
|
|
1150
|
+
data, status_code, headers = api_instance.send_list_with_http_info(token, opts)
|
|
1151
|
+
p status_code # => 2xx
|
|
1152
|
+
p headers # => { ... }
|
|
1153
|
+
p data # => <MessageSentResponse>
|
|
1154
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1155
|
+
puts "Error when calling MessagingApi->send_list_with_http_info: #{e}"
|
|
1156
|
+
end
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
### Parameters
|
|
1160
|
+
|
|
1161
|
+
| Name | Type | Description | Notes |
|
|
1162
|
+
| ---- | ---- | ----------- | ----- |
|
|
1163
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1164
|
+
| **send_list_request** | [**SendListRequest**](SendListRequest.md) | | [optional] |
|
|
1165
|
+
|
|
1166
|
+
### Return type
|
|
1167
|
+
|
|
1168
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1169
|
+
|
|
1170
|
+
### Authorization
|
|
1171
|
+
|
|
1172
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1173
|
+
|
|
1174
|
+
### HTTP request headers
|
|
1175
|
+
|
|
1176
|
+
- **Content-Type**: application/json
|
|
1177
|
+
- **Accept**: application/json
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
## send_location
|
|
1181
|
+
|
|
1182
|
+
> <MessageSentResponse> send_location(token, lat, lng, opts)
|
|
1183
|
+
|
|
1184
|
+
Send a Location
|
|
1185
|
+
|
|
1186
|
+
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.
|
|
1187
|
+
|
|
1188
|
+
### Examples
|
|
1189
|
+
|
|
1190
|
+
```ruby
|
|
1191
|
+
require 'time'
|
|
1192
|
+
require 'one_msg_chat_api'
|
|
1193
|
+
# setup authorization
|
|
1194
|
+
OneMsgChatApi.configure do |config|
|
|
1195
|
+
# Configure API key authorization: tokenAuth
|
|
1196
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1197
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1198
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1199
|
+
end
|
|
1200
|
+
|
|
1201
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1202
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1203
|
+
lat = 'lat_example' # String | Latitude of the location. Example: 45.018337
|
|
1204
|
+
lng = 'lng_example' # String | Longitude of the location. Example: -73.968285
|
|
1205
|
+
opts = {
|
|
1206
|
+
address: 'address_example', # String | Address of the location. Only displayed if name is present. Example: 9766 Valley View St., New York, NY 10024
|
|
1207
|
+
name: 'name_example', # String | Name of the location. Example: Facebook HQ
|
|
1208
|
+
quoted_msg_id: 'quoted_msg_id_example', # String | Quoted message ID (Cloud API)
|
|
1209
|
+
chat_id: 'chat_id_example', # String | Required if phone is not set. Chat ID from the message list. Examples: 12020721369@c.us or 120363046942338209@g.us(group)
|
|
1210
|
+
phone: 56 # Integer | Required if chatId is not set. A phone number starting with the country code. USA example: 12020721369.
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
begin
|
|
1214
|
+
# Send a Location
|
|
1215
|
+
result = api_instance.send_location(token, lat, lng, opts)
|
|
1216
|
+
p result
|
|
1217
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1218
|
+
puts "Error when calling MessagingApi->send_location: #{e}"
|
|
1219
|
+
end
|
|
1220
|
+
```
|
|
1221
|
+
|
|
1222
|
+
#### Using the send_location_with_http_info variant
|
|
1223
|
+
|
|
1224
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1225
|
+
|
|
1226
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_location_with_http_info(token, lat, lng, opts)
|
|
1227
|
+
|
|
1228
|
+
```ruby
|
|
1229
|
+
begin
|
|
1230
|
+
# Send a Location
|
|
1231
|
+
data, status_code, headers = api_instance.send_location_with_http_info(token, lat, lng, opts)
|
|
1232
|
+
p status_code # => 2xx
|
|
1233
|
+
p headers # => { ... }
|
|
1234
|
+
p data # => <MessageSentResponse>
|
|
1235
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1236
|
+
puts "Error when calling MessagingApi->send_location_with_http_info: #{e}"
|
|
1237
|
+
end
|
|
1238
|
+
```
|
|
1239
|
+
|
|
1240
|
+
### Parameters
|
|
1241
|
+
|
|
1242
|
+
| Name | Type | Description | Notes |
|
|
1243
|
+
| ---- | ---- | ----------- | ----- |
|
|
1244
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1245
|
+
| **lat** | **String** | Latitude of the location. Example: 45.018337 | |
|
|
1246
|
+
| **lng** | **String** | Longitude of the location. Example: -73.968285 | |
|
|
1247
|
+
| **address** | **String** | Address of the location. Only displayed if name is present. Example: 9766 Valley View St., New York, NY 10024 | [optional] |
|
|
1248
|
+
| **name** | **String** | Name of the location. Example: Facebook HQ | [optional] |
|
|
1249
|
+
| **quoted_msg_id** | **String** | Quoted message ID (Cloud API) | [optional] |
|
|
1250
|
+
| **chat_id** | **String** | Required if phone is not set. Chat ID from the message list. Examples: 12020721369@c.us or 120363046942338209@g.us(group) | [optional] |
|
|
1251
|
+
| **phone** | **Integer** | Required if chatId is not set. A phone number starting with the country code. USA example: 12020721369. | [optional] |
|
|
1252
|
+
|
|
1253
|
+
### Return type
|
|
1254
|
+
|
|
1255
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1256
|
+
|
|
1257
|
+
### Authorization
|
|
1258
|
+
|
|
1259
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1260
|
+
|
|
1261
|
+
### HTTP request headers
|
|
1262
|
+
|
|
1263
|
+
- **Content-Type**: application/x-www-form-urlencoded, application/json
|
|
1264
|
+
- **Accept**: application/json
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
## send_location_request
|
|
1268
|
+
|
|
1269
|
+
> <MessageSentResponse> send_location_request(token, opts)
|
|
1270
|
+
|
|
1271
|
+
Send Location Request Message
|
|
1272
|
+
|
|
1273
|
+
### Examples
|
|
1274
|
+
|
|
1275
|
+
```ruby
|
|
1276
|
+
require 'time'
|
|
1277
|
+
require 'one_msg_chat_api'
|
|
1278
|
+
# setup authorization
|
|
1279
|
+
OneMsgChatApi.configure do |config|
|
|
1280
|
+
# Configure API key authorization: tokenAuth
|
|
1281
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1282
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1283
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1284
|
+
end
|
|
1285
|
+
|
|
1286
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1287
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1288
|
+
opts = {
|
|
1289
|
+
send_location_request_request: OneMsgChatApi::SendLocationRequestRequest.new # SendLocationRequestRequest |
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
begin
|
|
1293
|
+
# Send Location Request Message
|
|
1294
|
+
result = api_instance.send_location_request(token, opts)
|
|
1295
|
+
p result
|
|
1296
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1297
|
+
puts "Error when calling MessagingApi->send_location_request: #{e}"
|
|
1298
|
+
end
|
|
1299
|
+
```
|
|
1300
|
+
|
|
1301
|
+
#### Using the send_location_request_with_http_info variant
|
|
1302
|
+
|
|
1303
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1304
|
+
|
|
1305
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_location_request_with_http_info(token, opts)
|
|
1306
|
+
|
|
1307
|
+
```ruby
|
|
1308
|
+
begin
|
|
1309
|
+
# Send Location Request Message
|
|
1310
|
+
data, status_code, headers = api_instance.send_location_request_with_http_info(token, opts)
|
|
1311
|
+
p status_code # => 2xx
|
|
1312
|
+
p headers # => { ... }
|
|
1313
|
+
p data # => <MessageSentResponse>
|
|
1314
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1315
|
+
puts "Error when calling MessagingApi->send_location_request_with_http_info: #{e}"
|
|
1316
|
+
end
|
|
1317
|
+
```
|
|
1318
|
+
|
|
1319
|
+
### Parameters
|
|
1320
|
+
|
|
1321
|
+
| Name | Type | Description | Notes |
|
|
1322
|
+
| ---- | ---- | ----------- | ----- |
|
|
1323
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1324
|
+
| **send_location_request_request** | [**SendLocationRequestRequest**](SendLocationRequestRequest.md) | | [optional] |
|
|
1325
|
+
|
|
1326
|
+
### Return type
|
|
1327
|
+
|
|
1328
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1329
|
+
|
|
1330
|
+
### Authorization
|
|
1331
|
+
|
|
1332
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1333
|
+
|
|
1334
|
+
### HTTP request headers
|
|
1335
|
+
|
|
1336
|
+
- **Content-Type**: application/json
|
|
1337
|
+
- **Accept**: application/json
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
## send_message
|
|
1341
|
+
|
|
1342
|
+
> <MessageSentResponse> send_message(token, body, opts)
|
|
1343
|
+
|
|
1344
|
+
Send a Message
|
|
1345
|
+
|
|
1346
|
+
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.
|
|
1347
|
+
|
|
1348
|
+
### Examples
|
|
1349
|
+
|
|
1350
|
+
```ruby
|
|
1351
|
+
require 'time'
|
|
1352
|
+
require 'one_msg_chat_api'
|
|
1353
|
+
# setup authorization
|
|
1354
|
+
OneMsgChatApi.configure do |config|
|
|
1355
|
+
# Configure API key authorization: tokenAuth
|
|
1356
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1357
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1358
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1359
|
+
end
|
|
1360
|
+
|
|
1361
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1362
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1363
|
+
body = 'body_example' # String | Message text, UTF-8 or UTF-16 string with emoji
|
|
1364
|
+
opts = {
|
|
1365
|
+
quoted_msg_id: 'quoted_msg_id_example', # String | Message ID to quote/reply to (Cloud API wamid)
|
|
1366
|
+
chat_id: 'chat_id_example', # String | Chat ID in format: phone@c.us (individual) or phone@g.us (group)
|
|
1367
|
+
phone: 56 # Integer | Phone number starting with country code (alternative to chatId)
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
begin
|
|
1371
|
+
# Send a Message
|
|
1372
|
+
result = api_instance.send_message(token, body, opts)
|
|
1373
|
+
p result
|
|
1374
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1375
|
+
puts "Error when calling MessagingApi->send_message: #{e}"
|
|
1376
|
+
end
|
|
1377
|
+
```
|
|
1378
|
+
|
|
1379
|
+
#### Using the send_message_with_http_info variant
|
|
1380
|
+
|
|
1381
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1382
|
+
|
|
1383
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_message_with_http_info(token, body, opts)
|
|
1384
|
+
|
|
1385
|
+
```ruby
|
|
1386
|
+
begin
|
|
1387
|
+
# Send a Message
|
|
1388
|
+
data, status_code, headers = api_instance.send_message_with_http_info(token, body, opts)
|
|
1389
|
+
p status_code # => 2xx
|
|
1390
|
+
p headers # => { ... }
|
|
1391
|
+
p data # => <MessageSentResponse>
|
|
1392
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1393
|
+
puts "Error when calling MessagingApi->send_message_with_http_info: #{e}"
|
|
1394
|
+
end
|
|
1395
|
+
```
|
|
1396
|
+
|
|
1397
|
+
### Parameters
|
|
1398
|
+
|
|
1399
|
+
| Name | Type | Description | Notes |
|
|
1400
|
+
| ---- | ---- | ----------- | ----- |
|
|
1401
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1402
|
+
| **body** | **String** | Message text, UTF-8 or UTF-16 string with emoji | |
|
|
1403
|
+
| **quoted_msg_id** | **String** | Message ID to quote/reply to (Cloud API wamid) | [optional] |
|
|
1404
|
+
| **chat_id** | **String** | Chat ID in format: phone@c.us (individual) or phone@g.us (group) | [optional] |
|
|
1405
|
+
| **phone** | **Integer** | Phone number starting with country code (alternative to chatId) | [optional] |
|
|
1406
|
+
|
|
1407
|
+
### Return type
|
|
1408
|
+
|
|
1409
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1410
|
+
|
|
1411
|
+
### Authorization
|
|
1412
|
+
|
|
1413
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1414
|
+
|
|
1415
|
+
### HTTP request headers
|
|
1416
|
+
|
|
1417
|
+
- **Content-Type**: application/x-www-form-urlencoded, application/json
|
|
1418
|
+
- **Accept**: application/json
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
## send_order_details
|
|
1422
|
+
|
|
1423
|
+
> <MessageSentResponse> send_order_details(token, send_order_details_request)
|
|
1424
|
+
|
|
1425
|
+
Send order details (India payments template)
|
|
1426
|
+
|
|
1427
|
+
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 } } } } }] } ```
|
|
1428
|
+
|
|
1429
|
+
### Examples
|
|
1430
|
+
|
|
1431
|
+
```ruby
|
|
1432
|
+
require 'time'
|
|
1433
|
+
require 'one_msg_chat_api'
|
|
1434
|
+
# setup authorization
|
|
1435
|
+
OneMsgChatApi.configure do |config|
|
|
1436
|
+
# Configure API key authorization: tokenAuth
|
|
1437
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1438
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1439
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1440
|
+
end
|
|
1441
|
+
|
|
1442
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1443
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1444
|
+
send_order_details_request = OneMsgChatApi::SendOrderDetailsRequest.new({template: 'order_details_utility', namespace: 'your_namespace_uuid', language: OneMsgChatApi::SendOrderDetailsRequestLanguage.new({code: 'en'}), order: OneMsgChatApi::SendOrderDetailsRequestOrder.new({items: [OneMsgChatApi::SendOrderDetailsRequestOrderItemsInner.new]})}) # SendOrderDetailsRequest |
|
|
1445
|
+
|
|
1446
|
+
begin
|
|
1447
|
+
# Send order details (India payments template)
|
|
1448
|
+
result = api_instance.send_order_details(token, send_order_details_request)
|
|
1449
|
+
p result
|
|
1450
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1451
|
+
puts "Error when calling MessagingApi->send_order_details: #{e}"
|
|
1452
|
+
end
|
|
1453
|
+
```
|
|
1454
|
+
|
|
1455
|
+
#### Using the send_order_details_with_http_info variant
|
|
1456
|
+
|
|
1457
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1458
|
+
|
|
1459
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_order_details_with_http_info(token, send_order_details_request)
|
|
1460
|
+
|
|
1461
|
+
```ruby
|
|
1462
|
+
begin
|
|
1463
|
+
# Send order details (India payments template)
|
|
1464
|
+
data, status_code, headers = api_instance.send_order_details_with_http_info(token, send_order_details_request)
|
|
1465
|
+
p status_code # => 2xx
|
|
1466
|
+
p headers # => { ... }
|
|
1467
|
+
p data # => <MessageSentResponse>
|
|
1468
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1469
|
+
puts "Error when calling MessagingApi->send_order_details_with_http_info: #{e}"
|
|
1470
|
+
end
|
|
1471
|
+
```
|
|
1472
|
+
|
|
1473
|
+
### Parameters
|
|
1474
|
+
|
|
1475
|
+
| Name | Type | Description | Notes |
|
|
1476
|
+
| ---- | ---- | ----------- | ----- |
|
|
1477
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1478
|
+
| **send_order_details_request** | [**SendOrderDetailsRequest**](SendOrderDetailsRequest.md) | | |
|
|
1479
|
+
|
|
1480
|
+
### Return type
|
|
1481
|
+
|
|
1482
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1483
|
+
|
|
1484
|
+
### Authorization
|
|
1485
|
+
|
|
1486
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1487
|
+
|
|
1488
|
+
### HTTP request headers
|
|
1489
|
+
|
|
1490
|
+
- **Content-Type**: application/json
|
|
1491
|
+
- **Accept**: application/json
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
## send_payment_request
|
|
1495
|
+
|
|
1496
|
+
> <MessageSentResponse> send_payment_request(token, send_payment_request_request)
|
|
1497
|
+
|
|
1498
|
+
Send payment request (regional)
|
|
1499
|
+
|
|
1500
|
+
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.
|
|
1501
|
+
|
|
1502
|
+
### Examples
|
|
1503
|
+
|
|
1504
|
+
```ruby
|
|
1505
|
+
require 'time'
|
|
1506
|
+
require 'one_msg_chat_api'
|
|
1507
|
+
# setup authorization
|
|
1508
|
+
OneMsgChatApi.configure do |config|
|
|
1509
|
+
# Configure API key authorization: tokenAuth
|
|
1510
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1511
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1512
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1513
|
+
end
|
|
1514
|
+
|
|
1515
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1516
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1517
|
+
send_payment_request_request = OneMsgChatApi::SendPaymentRequestRequest.new({phone: 37, region: 'IN'}) # SendPaymentRequestRequest |
|
|
1518
|
+
|
|
1519
|
+
begin
|
|
1520
|
+
# Send payment request (regional)
|
|
1521
|
+
result = api_instance.send_payment_request(token, send_payment_request_request)
|
|
1522
|
+
p result
|
|
1523
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1524
|
+
puts "Error when calling MessagingApi->send_payment_request: #{e}"
|
|
1525
|
+
end
|
|
1526
|
+
```
|
|
1527
|
+
|
|
1528
|
+
#### Using the send_payment_request_with_http_info variant
|
|
1529
|
+
|
|
1530
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1531
|
+
|
|
1532
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_payment_request_with_http_info(token, send_payment_request_request)
|
|
1533
|
+
|
|
1534
|
+
```ruby
|
|
1535
|
+
begin
|
|
1536
|
+
# Send payment request (regional)
|
|
1537
|
+
data, status_code, headers = api_instance.send_payment_request_with_http_info(token, send_payment_request_request)
|
|
1538
|
+
p status_code # => 2xx
|
|
1539
|
+
p headers # => { ... }
|
|
1540
|
+
p data # => <MessageSentResponse>
|
|
1541
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1542
|
+
puts "Error when calling MessagingApi->send_payment_request_with_http_info: #{e}"
|
|
1543
|
+
end
|
|
1544
|
+
```
|
|
1545
|
+
|
|
1546
|
+
### Parameters
|
|
1547
|
+
|
|
1548
|
+
| Name | Type | Description | Notes |
|
|
1549
|
+
| ---- | ---- | ----------- | ----- |
|
|
1550
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1551
|
+
| **send_payment_request_request** | [**SendPaymentRequestRequest**](SendPaymentRequestRequest.md) | | |
|
|
1552
|
+
|
|
1553
|
+
### Return type
|
|
1554
|
+
|
|
1555
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1556
|
+
|
|
1557
|
+
### Authorization
|
|
1558
|
+
|
|
1559
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1560
|
+
|
|
1561
|
+
### HTTP request headers
|
|
1562
|
+
|
|
1563
|
+
- **Content-Type**: application/json
|
|
1564
|
+
- **Accept**: application/json
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
## send_product
|
|
1568
|
+
|
|
1569
|
+
> <MessageSentResponse> send_product(token, opts)
|
|
1570
|
+
|
|
1571
|
+
Send a Product
|
|
1572
|
+
|
|
1573
|
+
### Examples
|
|
1574
|
+
|
|
1575
|
+
```ruby
|
|
1576
|
+
require 'time'
|
|
1577
|
+
require 'one_msg_chat_api'
|
|
1578
|
+
# setup authorization
|
|
1579
|
+
OneMsgChatApi.configure do |config|
|
|
1580
|
+
# Configure API key authorization: tokenAuth
|
|
1581
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1582
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1583
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1584
|
+
end
|
|
1585
|
+
|
|
1586
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1587
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1588
|
+
opts = {
|
|
1589
|
+
request_body: { key: 3.56} # Hash<String, Object> |
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
begin
|
|
1593
|
+
# Send a Product
|
|
1594
|
+
result = api_instance.send_product(token, opts)
|
|
1595
|
+
p result
|
|
1596
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1597
|
+
puts "Error when calling MessagingApi->send_product: #{e}"
|
|
1598
|
+
end
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1601
|
+
#### Using the send_product_with_http_info variant
|
|
1602
|
+
|
|
1603
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1604
|
+
|
|
1605
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_product_with_http_info(token, opts)
|
|
1606
|
+
|
|
1607
|
+
```ruby
|
|
1608
|
+
begin
|
|
1609
|
+
# Send a Product
|
|
1610
|
+
data, status_code, headers = api_instance.send_product_with_http_info(token, opts)
|
|
1611
|
+
p status_code # => 2xx
|
|
1612
|
+
p headers # => { ... }
|
|
1613
|
+
p data # => <MessageSentResponse>
|
|
1614
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1615
|
+
puts "Error when calling MessagingApi->send_product_with_http_info: #{e}"
|
|
1616
|
+
end
|
|
1617
|
+
```
|
|
1618
|
+
|
|
1619
|
+
### Parameters
|
|
1620
|
+
|
|
1621
|
+
| Name | Type | Description | Notes |
|
|
1622
|
+
| ---- | ---- | ----------- | ----- |
|
|
1623
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1624
|
+
| **request_body** | [**Hash<String, Object>**](Object.md) | | [optional] |
|
|
1625
|
+
|
|
1626
|
+
### Return type
|
|
1627
|
+
|
|
1628
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1629
|
+
|
|
1630
|
+
### Authorization
|
|
1631
|
+
|
|
1632
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1633
|
+
|
|
1634
|
+
### HTTP request headers
|
|
1635
|
+
|
|
1636
|
+
- **Content-Type**: application/json
|
|
1637
|
+
- **Accept**: application/json
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
## send_reaction
|
|
1641
|
+
|
|
1642
|
+
> <MessageSentResponse> send_reaction(token, opts)
|
|
1643
|
+
|
|
1644
|
+
Send Reaction
|
|
1645
|
+
|
|
1646
|
+
### Examples
|
|
1647
|
+
|
|
1648
|
+
```ruby
|
|
1649
|
+
require 'time'
|
|
1650
|
+
require 'one_msg_chat_api'
|
|
1651
|
+
# setup authorization
|
|
1652
|
+
OneMsgChatApi.configure do |config|
|
|
1653
|
+
# Configure API key authorization: tokenAuth
|
|
1654
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1655
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1656
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1657
|
+
end
|
|
1658
|
+
|
|
1659
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1660
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1661
|
+
opts = {
|
|
1662
|
+
send_reaction_request: OneMsgChatApi::SendReactionRequest.new # SendReactionRequest |
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
begin
|
|
1666
|
+
# Send Reaction
|
|
1667
|
+
result = api_instance.send_reaction(token, opts)
|
|
1668
|
+
p result
|
|
1669
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1670
|
+
puts "Error when calling MessagingApi->send_reaction: #{e}"
|
|
1671
|
+
end
|
|
1672
|
+
```
|
|
1673
|
+
|
|
1674
|
+
#### Using the send_reaction_with_http_info variant
|
|
1675
|
+
|
|
1676
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1677
|
+
|
|
1678
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_reaction_with_http_info(token, opts)
|
|
1679
|
+
|
|
1680
|
+
```ruby
|
|
1681
|
+
begin
|
|
1682
|
+
# Send Reaction
|
|
1683
|
+
data, status_code, headers = api_instance.send_reaction_with_http_info(token, opts)
|
|
1684
|
+
p status_code # => 2xx
|
|
1685
|
+
p headers # => { ... }
|
|
1686
|
+
p data # => <MessageSentResponse>
|
|
1687
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1688
|
+
puts "Error when calling MessagingApi->send_reaction_with_http_info: #{e}"
|
|
1689
|
+
end
|
|
1690
|
+
```
|
|
1691
|
+
|
|
1692
|
+
### Parameters
|
|
1693
|
+
|
|
1694
|
+
| Name | Type | Description | Notes |
|
|
1695
|
+
| ---- | ---- | ----------- | ----- |
|
|
1696
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1697
|
+
| **send_reaction_request** | [**SendReactionRequest**](SendReactionRequest.md) | | [optional] |
|
|
1698
|
+
|
|
1699
|
+
### Return type
|
|
1700
|
+
|
|
1701
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1702
|
+
|
|
1703
|
+
### Authorization
|
|
1704
|
+
|
|
1705
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1706
|
+
|
|
1707
|
+
### HTTP request headers
|
|
1708
|
+
|
|
1709
|
+
- **Content-Type**: application/json
|
|
1710
|
+
- **Accept**: application/json
|
|
1711
|
+
|
|
1712
|
+
|
|
1713
|
+
## send_sticker
|
|
1714
|
+
|
|
1715
|
+
> <MessageSentResponse> send_sticker(token, send_sticker_request)
|
|
1716
|
+
|
|
1717
|
+
Send sticker message
|
|
1718
|
+
|
|
1719
|
+
Send a WhatsApp sticker by mediaId or link URL.
|
|
1720
|
+
|
|
1721
|
+
### Examples
|
|
1722
|
+
|
|
1723
|
+
```ruby
|
|
1724
|
+
require 'time'
|
|
1725
|
+
require 'one_msg_chat_api'
|
|
1726
|
+
# setup authorization
|
|
1727
|
+
OneMsgChatApi.configure do |config|
|
|
1728
|
+
# Configure API key authorization: tokenAuth
|
|
1729
|
+
config.api_key['token'] = 'YOUR API KEY'
|
|
1730
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
1731
|
+
# config.api_key_prefix['token'] = 'Bearer'
|
|
1732
|
+
end
|
|
1733
|
+
|
|
1734
|
+
api_instance = OneMsgChatApi::MessagingApi.new
|
|
1735
|
+
token = 'token_example' # String | JWT token or API key for authorization
|
|
1736
|
+
send_sticker_request = OneMsgChatApi::SendStickerRequest.new # SendStickerRequest |
|
|
1737
|
+
|
|
1738
|
+
begin
|
|
1739
|
+
# Send sticker message
|
|
1740
|
+
result = api_instance.send_sticker(token, send_sticker_request)
|
|
1741
|
+
p result
|
|
1742
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1743
|
+
puts "Error when calling MessagingApi->send_sticker: #{e}"
|
|
1744
|
+
end
|
|
1745
|
+
```
|
|
1746
|
+
|
|
1747
|
+
#### Using the send_sticker_with_http_info variant
|
|
1748
|
+
|
|
1749
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1750
|
+
|
|
1751
|
+
> <Array(<MessageSentResponse>, Integer, Hash)> send_sticker_with_http_info(token, send_sticker_request)
|
|
1752
|
+
|
|
1753
|
+
```ruby
|
|
1754
|
+
begin
|
|
1755
|
+
# Send sticker message
|
|
1756
|
+
data, status_code, headers = api_instance.send_sticker_with_http_info(token, send_sticker_request)
|
|
1757
|
+
p status_code # => 2xx
|
|
1758
|
+
p headers # => { ... }
|
|
1759
|
+
p data # => <MessageSentResponse>
|
|
1760
|
+
rescue OneMsgChatApi::ApiError => e
|
|
1761
|
+
puts "Error when calling MessagingApi->send_sticker_with_http_info: #{e}"
|
|
1762
|
+
end
|
|
1763
|
+
```
|
|
1764
|
+
|
|
1765
|
+
### Parameters
|
|
1766
|
+
|
|
1767
|
+
| Name | Type | Description | Notes |
|
|
1768
|
+
| ---- | ---- | ----------- | ----- |
|
|
1769
|
+
| **token** | **String** | JWT token or API key for authorization | |
|
|
1770
|
+
| **send_sticker_request** | [**SendStickerRequest**](SendStickerRequest.md) | | |
|
|
1771
|
+
|
|
1772
|
+
### Return type
|
|
1773
|
+
|
|
1774
|
+
[**MessageSentResponse**](MessageSentResponse.md)
|
|
1775
|
+
|
|
1776
|
+
### Authorization
|
|
1777
|
+
|
|
1778
|
+
[tokenAuth](../README.md#tokenAuth)
|
|
1779
|
+
|
|
1780
|
+
### HTTP request headers
|
|
1781
|
+
|
|
1782
|
+
- **Content-Type**: application/json
|
|
1783
|
+
- **Accept**: application/json
|
|
1784
|
+
|