From d2e2d92a8ae92fee284cb7d9ab781854352fd49d Mon Sep 17 00:00:00 2001 From: Denver Gingerich Date: Wed, 22 Apr 2020 02:36:34 +0000 Subject: [PATCH] translate more parameters to V2 for more progress Now we get even further than in 6abd653 - since we have updated the 'to' so we use 'owner' instead, which is a string instead of a list. In particular, we now get a message delivered (woo!), though it's of the form: 'unknown type () with text: ' So still a bit of work to do yet. Also, we updated a couple other fields with their appropriate analogs. --- sgx-bwmsgsv2.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index d26c798fe99ebf8b6bcdf60e6ea49cd9e573a8fc..1d9dc637f8d4fdad6324e0e9897fdcacc7bdb780 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -788,14 +788,16 @@ class WebhookHandler < Goliath::API # TODO: process each message in list, not just first one jparams = params['_json'][0]['message'] + type = params['_json'][0]['type'] + users_num = '' others_num = '' if jparams['direction'] == 'in' - users_num = jparams['to'] + users_num = jparams['owner'] others_num = jparams['from'] elsif jparams['direction'] == 'out' users_num = jparams['from'] - others_num = jparams['to'] + others_num = jparams['owner'] else # TODO: exception or similar puts "big prob: '" + jparams['direction'] + "'" + body @@ -803,8 +805,8 @@ class WebhookHandler < Goliath::API end puts 'BODY - messageId: ' + jparams['id'] + - #', eventType: ' + jparams['eventType'] + - #', time: ' + jparams['time'] + + ', eventType: ' + type + + ', time: ' + jparams['time'] + ', direction: ' + jparams['direction'] + #', state: ' + jparams['state'] + ', deliveryState: ' + (jparams['deliveryState'] ?