-
Notifications
You must be signed in to change notification settings - Fork 14
v1 -> v2 Migration for Messaging 2.0 #39
Description
https://dev.bandwidth.com/v2-messaging/messaging2Migration.html
The ones I could find are:
- Update request params
Add applicationId in its payload for v2.
Currently it looks like https://github.com/Bandwidth/python-bandwidth/blob/master/bandwidth/messaging/client_module.py#L197.
Also drop other unwanted params based on version.
- Update
message_idextraction logic.
v1 has themessage_id in this Location header where it is being extracted from currently as seen here https://github.com/Bandwidth/python-bandwidth/blob/master/bandwidth/messaging/client_module.py#L87
v2 just returns a JSON like below where we will have to extract it from.
{
"id" : "14762070468292kw2fuqty55yp2b2",
"time" : "2016-09-14T18:20:16Z",
"to" : [
"+12345678902",
"+12345678903"
],
"from" : "+12345678901",
"text" : "Hey, check this out!",
"applicationId" : "93de2206-9669-4e07-948d-329f4b722ee2",
"tag" : "test message",
"owner" : "+12345678901",
"direction" : "out",
"segmentCount" : 1
}
- Error handling.
Right now we get the response.json() and fetch the message as well as code keys from it as seen here https://github.com/Bandwidth/python-bandwidth/blob/master/bandwidth/messaging/client_module.py#L72
But v2 seems to send back an "array of objects" and the name of the keys also seem to be different. Based on what I was able to gather, looks like we have replace that logic with response.json()[0] , data['description'] and code=data.get('type')).
Are there plans to make an exhaustive list and work on updating the repo to support v2? Would be happy to help.