lib/whats/actions/send_hsm_message.rb in whatsapp-0.1.3 vs lib/whats/actions/send_hsm_message.rb in whatsapp-0.1.4
- old
+ new
@@ -1,15 +1,15 @@
# frozen_string_literal: true
module Whats
module Actions
class SendHsmMessage
- PATH = "/api/rest_send.php"
+ PATH = "/v1/messages"
- def initialize(client, username, namespace, element_name, params)
+ def initialize(client, wa_id, namespace, element_name, params)
@client = client
- @username = username
+ @wa_id = wa_id
@namespace = namespace
@element_name = element_name
@params = params
end
@@ -17,20 +17,22 @@
client.request PATH, payload
end
private
- attr_reader :client, :username, :namespace, :element_name, :params
+ attr_reader :client, :wa_id, :namespace, :element_name, :params
def payload
{
- payload: {
- to: username,
- hsm: {
- namespace: namespace,
- element_name: element_name,
- localizable_params: params
- }
+ type: "hsm",
+ recipient_type: "individual",
+ to: wa_id,
+ hsm: {
+ namespace: namespace,
+ element_name: element_name,
+ fallback_lg: "pt",
+ fallback_lc: "BR",
+ localizable_params: params
}
}
end
end
end