Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Messages API Features #465

Merged
merged 2 commits into from
Jan 25, 2024
Merged

New Messages API Features #465

merged 2 commits into from
Jan 25, 2024

Conversation

SecondeJK
Copy link
Contributor

@SecondeJK SecondeJK commented Jan 18, 2024

This PR provides parity with new Messages API features.

Description

webhook_url and webhook_version have been added to all Messages API Objects
sms property added to outbound SMS text objects, containing encoding_type, content_id, entity_id and ttl
MMS vCard now has caption
WhatsApp File object now has name

Fixed the Viber Video object which was missing the viber_service object, but now has mandatory duration and file_size keys

Motivation and Context

Parity with Vonage APIs

How Has This Been Tested?

Existing tests have been modified

Example Output or Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link

@superchilled superchilled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I just had a question about Messages/MessageObjects. Are the same objects (and therefore properties) used across different channels? For example, with FileObject, the __construct function can set properties on the object for url, caption, and name, which is fine for a WhatsApp file message (which can include all three properties), but not a Viber file message, which only has url and name.

From my understanding of the code, it looks like it would be possible to construct a Viber file message which included a caption property (which would then result in error on the API side). Or perhaps I'm missing something in my understanding of __construct?

@SecondeJK
Copy link
Contributor Author

@superchilled That's true: you could actually send a file object with the caption for Viber - the way it works is with default values so that it's up to the user to populate the object correctly.

As the channels become more complex, I might introduce a validation set of classes. I don't want to extend the file objects for every channel - there's already more objects than I'd like. But with a validator, it could decorate them to say "you've done it wrong"

@superchilled superchilled self-requested a review January 22, 2024 12:36
@superchilled
Copy link

@superchilled That's true: you could actually send a file object with the caption for Viber - the way it works is with default values so that it's up to the user to populate the object correctly.

As the channels become more complex, I might introduce a validation set of classes. I don't want to extend the file objects for every channel - there's already more objects than I'd like. But with a validator, it could decorate them to say "you've done it wrong"

Thanks Jim. That makes sense! :)

@SecondeJK SecondeJK merged commit 2b0306e into main Jan 25, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants