15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/lita/handlers/visitor_notification_handler.rb', line 15
def notify_visitor(response)
groups = response.matches[0]
if groups.size == 2
notification = {
:guest_name => groups[0],
:location_name => groups[1],
}
else
notification = {
:host_name => groups[0],
:guest_name => groups[1],
:location_name => groups[2],
}
end
payload = notification.to_json
if config.webhook_url
resp = HTTParty.post(
config.webhook_url,
body: payload,
headers: config.,
)
end
response.reply(payload)
end
|