translate more parameters to V2 for more progress
Denver Gingerich
created 5 years ago
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: <text>'
So still a bit of work to do yet. Also, we updated a couple other
fields with their appropriate analogs.
Change summary
sgx-bwmsgsv2.rb | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Detailed changes
@@ -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'] ?