first successful message, after some more V2 fixes

Denver Gingerich created

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.

Change summary

sgx-bwmsgsv2.rb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Detailed changes

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