Chatwoot/app/services/whatsapp/providers/base_service.rb

30 lines
911 B
Ruby
Raw Permalink Normal View History

#######################################
# To create a whatsapp provider
# - Inherit this as the base class.
# - Implement `send_message` method in your child class.
# - Implement `send_template_message` method in your child class.
# - Implement `sync_templates` method in your child class.
# - Implement `validate_provider_config` method in your child class.
# - Use Childclass.new(whatsapp_channel: channel).perform.
######################################
class Whatsapp::Providers::BaseService
pattr_initialize [:whatsapp_channel!]
def send_message(_phone_number, _message)
raise 'Overwrite this method in child class'
end
def send_template(_phone_number, _template_info)
raise 'Overwrite this method in child class'
end
def sync_template
raise 'Overwrite this method in child class'
end
def validate_provider_config
raise 'Overwrite this method in child class'
end
end