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