Sha256: e507c2126d4f8cb4a8fe1a917f0d435e71327683a10f474d8aff3f1e5962246b
Contents?: true
Size: 1.29 KB
Versions: 4
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': 'en' } } } } payload[:data][:message_template].merge!(params) payload end end end end
Version data entries
4 entries across 4 versions & 1 rubygems