From 2f3091fc7d08c8f68ca1e274386216ca01cf94b5 Mon Sep 17 00:00:00 2001 From: Denver Gingerich Date: Wed, 22 Apr 2020 02:57:50 +0000 Subject: [PATCH] first successful message, after some more V2 fixes Now we get a normal message via XMPP on a V2-style JSON blob, after fixing the type info. Group texts are not yet handled - that will be next. --- sgx-bwmsgsv2.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index 1d9dc637f8d4fdad6324e0e9897fdcacc7bdb780..2f345f6d8598d49924e2a3bd29ea6ac261b3e045 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -842,7 +842,7 @@ class WebhookHandler < Goliath::API case jparams['direction'] when 'in' text = '' - case jparams['eventType'] + case type when 'sms' text = jparams['text'] when 'mms' @@ -888,8 +888,11 @@ class WebhookHandler < Goliath::API end return [200, {}, "OK"] + when 'message-received' + # TODO: handle group chat, and fix above + text = jparams['text'] else - text = "unknown type (#{jparams['eventType']})"\ + text = "unknown type (#{type})"\ " with text: " + jparams['text'] # TODO: log/notify of this properly