Skip to content

[Notifier] added "callback" support for texter transports #34629

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

Closed
wants to merge 1 commit into from

Conversation

imiroslavov
Copy link
Contributor

@imiroslavov imiroslavov commented Nov 26, 2019

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets n/a
License MIT
Doc PR n/a

Adding support for Twilio/Nexmo webhook endpoints used to monitor status changes.
It adds a callback parameter to the DSN.

e.g twilio://SID:TOKEN@default?from=PHONE&callback=http://domain.tld/path

  • fix the tests (if there are any)

@javiereguiluz
Copy link
Member

@imiroslavov just asking in case this is merged and we need to document it: must the callback value be escaped somehow before including it to the DSN?

For example, in some parts of the docs we say this for the DATABASE_URL DSN:

If the username, password, host or database name contain any character
considered special in a URI (such as +, @, $, #, /,
:, *, !), you must encode them.

Thanks.

@imiroslavov
Copy link
Contributor Author

@javiereguiluz The query parameters of the DSN are passed to parse_str so yes. The callback URL can/must be entirely escaped.

@imiroslavov
Copy link
Contributor Author

If #34654 is merged before this PR it will require additional work.

@fabpot fabpot added the Notifier label Feb 4, 2020
Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Thank you.

I like this PR. Could you rebase it and add this feature to Sinch too?

And a small tests would be perfect =)

@imiroslavov
Copy link
Contributor Author

imiroslavov commented Jun 29, 2020

@Nyholm Sorry for the late reply. The idea initially sounded good but right now I see only downsides.

  1. Hard-coding the URL is a bad practice.
  2. In most of the cases you will want to track the result of the callback in a previously created database record (preliminary record). The most adequate way is to generate a callback URL that contains the ID of that record which is not possible in this PR. (e.g create preliminary SMS record with status "pending". Then update it to "sent", "delivered" etc. depending on the callback data)
  3. After this PR was submitted an adapter for "ovhcloud" was added which doesn't support different callbacks per request.

I'm stuck at this point. Maybe a callback envelope will be a better solution but not implementing it for all adapters doesn't sound right.

I will have enough free time to work on this next week so I'm open for suggestions.

@fabpot
Copy link
Member

fabpot commented Aug 13, 2020

I would add that the payload of the callback wouldn't be the same depending on the provider. I propose to close for now until we have a better idea.

@fabpot fabpot closed this Aug 13, 2020
@imiroslavov
Copy link
Contributor Author

@fabpot The provider can also be added to the callback URL but that would lead to compromises and probably more problems in the user's code, so closing the PR is the best option.

@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants