1# frozen_string_literal: true
 2
 3class WelcomeMessage
 4	def initialize(customer, tel)
 5		@customer = customer
 6		@tel = tel
 7	end
 8
 9	def welcome
10		EM.promise_timer(10).then do
11			# Wait for cheogram to get the finish and set up the route
12			@customer.stanza_to(message)
13		end
14	end
15
16	def message
17		m = Blather::Stanza::Message.new
18		m.from = CONFIG[:notify_from]
19		m.body =
20			"Welcome to JMP!  Your JMP number is #{@tel}. This is an automated " \
21			"message, but anything you send here will go direct to real humans " \
22			"who will be happy to help you.  Such support requests will get a " \
23			"reply within 8 business hours.\n\n" \
24			"FAQ: https://jmp.chat/faq\n\n" \
25			"Account Settings: xmpp:cheogram.com?command"
26		m
27	end
28end