lib/whats/actions/send_message.rb in whatsapp-0.1.3 vs lib/whats/actions/send_message.rb in whatsapp-0.1.4
- old
+ new
@@ -1,29 +1,31 @@
# frozen_string_literal: true
module Whats
module Actions
class SendMessage
- PATH = "/api/rest_send.php"
+ PATH = "/v1/messages"
- def initialize(client, username, body)
- @client = client
- @username = username
- @body = body
+ def initialize(client, wa_id, body)
+ @client = client
+ @wa_id = wa_id
+ @body = body
end
def call
client.request PATH, payload
end
private
- attr_reader :client, :username, :body
+ attr_reader :client, :wa_id, :body
def payload
{
- payload: {
- to: username,
+ recipient_type: "individual",
+ to: wa_id,
+ type: "text",
+ text: {
body: body
}
}
end
end