Skip to content
This repository was archived by the owner on Feb 10, 2021. It is now read-only.
This repository was archived by the owner on Feb 10, 2021. It is now read-only.

v1 -> v2 Migration for Messaging 2.0 #39

@harisibrahimkv

Description

@harisibrahimkv

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_id extraction 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions