Sha256: f11d0b8437b1d5992ed4f76f7d046b6a636977474c6449ba80e336314858f61d
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module FreshchatWhatsapp module Actions class SendHsmMessage PATH = '/v2/outbound-messages/whatsapp' def initialize(client, from_number, wtsapp_phone_number, namespace, template_name, language, params) @from_number = from_number @phone_number = wtsapp_phone_number @namespace = namespace @template_name = template_name @language = language @params = params @client = client end def call client.request PATH, payload end private attr_reader :client, :wtsapp_phone_number, :namespace, :template_name, :language, :params def payload payload = { 'from': { 'phone_number': @from_number }, 'to': [ { 'phone_number': @phone_number } ], 'data': { 'message_template': { 'storage': 'conversation', 'namespace': @namespace, 'template_name': @template_name, 'language': { 'policy': 'deterministic', 'code': @language } } } } payload[:data][:message_template].merge!(params) payload end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
freshchat_whatsapp-0.1.5 | lib/freshchat_whatsapp/actions/send_hsm_message.rb |
freshchat_whatsapp-0.1.4 | lib/freshchat_whatsapp/actions/send_hsm_message.rb |