twilio / twilio-php

A PHP library for communicating with the Twilio REST API and generating TwiML.
MIT License
1.56k stars 558 forks source link

Required MessageFlow Field Missing from UsAppToPersonList->create #748

Closed ShawnFUB closed 1 year ago

ShawnFUB commented 1 year ago

Issue Summary

Twilio is introducing new required fields to one the Business Registration API endpoints in a breaking change on November 17th, however these fields are not currently supported by the PHP REST library.

Per their migration guide which provides examples in CURL - there are several new fields on this endpoint. In particular the MessageFlow field seems to be required in all cases regardless of a customer's use of Twilio's Default/Advanced Opt-Out.

Customers who are not using these features will have additional fields relating to their Opt-In/Opt-Out messaging policies which are also required in addition to the MessageFlow parameter.

The public documentation for this API endpoint contains examples of using the PHP library, however those examples do not include the MessageFlow field which will soon be required.

Steps to Reproduce

  1. Attempt to submit new required field MessageFlow to the https://messaging.twilio.com/v1/Services/MGXXX/ Compliance/Usa2p endpoint using the PHP REST library.
  2. See that this is not currently possible.

Code Snippet

(This example is copied from the Twilio API documentation - comment added.)

$us_app_to_person = $twilio->messaging->v1->services("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
         ->usAppToPerson
         ->create("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", // brandRegistrationSid
                     "description", // description
                     ["message_samples"], // messageSamples
                     "us_app_to_person_usecase", // usAppToPersonUsecase
                     True, // hasEmbeddedLinks
                     True // hasEmbeddedPhone
                     // It should be possible to pass additional arguments or an object/associative array to this method to provide MessageFlow and the other Opt In/Opt Out fields which will soon be required by Twilio.
          );

Technical details:

childish-sambino commented 1 year ago

Checking with the product team on the timing of the changes, and as it currently stands (looking at the proposed API change) none of the new params will be hard required by the edge (which may change?). Will circle back when I know more.

Linking related community PR for additional reference/context: https://github.com/twilio/twilio-python/pull/621

ShawnFUB commented 1 year ago

@childish-sambino - thank you for the quick response.

Per the email they sent out, they indicated that one of the new fields would be required, and the rest would be required in some scenarios (note that the October 20th deadline has since been pushed back to November 17th.)

Effective October 20, 2022, The Campaign Registry (TCR) has mandated new guidelines applicable to every provider registering for US A2P 10DLC brands via TCR. As a result, Twilio is making code-breaking changes to the A2P Campaign Creation API and Twilio Console - Trust Hub - A2P Messaging [...] Message Flow / Call to Action: Customers need to provide details about how a consumer opts-in to their campaign (how a customer gives consent to receive their messages). If multiple opt-in methods can be used for the same campaign, they must all be listed. [emphasis mine]

The migration document also includes a table showing when each field is required. The MessageFlow field seems to be required in all cases, even if the customer is using Twilio's default Opt-In/Opt-Out.

I forked this repo and was going to submit a PR to introduce this as an optional parameter to the UsAppToPersonList->create() method - but I see now that the files in question are generated files. If you'd like to see the diff of my changes though, they can be found here.

ShawnFUB commented 1 year ago

Apologies, didn't mean to close this issue! Reopening.

Andygmb commented 1 year ago

Including a +1 to this being included across all the available generated REST clients. The messageflow field is going to be required, it is a necessity that twilio updates their client libraries before Nov 17th @childish-sambino

childish-sambino commented 1 year ago

@Andygmb Understood. I'm checking with the product team to see if we can get this updated in the API sooner to allow for migration.

ShawnFUB commented 1 year ago

@childish-sambino FYI - we reached out to our Customer Success contact at Twilio and they indicated that TCR (who they submit business registrations to) will not be rolling out the new API until the 17th:

we are being told that nothing will be available until Nov 17th. [...] Unfortunately, we cannot make it available any sooner as TCR won't make the endpoints available to us until then and, yes, this will be the date the carriers start to require the additional information (for net new business registrations). [...] For now, you must wait to make changes until Nov 17th.

It would be nice if Twilio could begin accepting the new fields sooner, even if they are just ignored by the API for the time being. But that may create a false sense of forward-compatiblility if there's no non-breaking migration path being offered to Twilio by the TCR.

kimihiro64 commented 1 year ago

I believe that sending extraneous fields to the API should have no bad effects, and either way the client could be released earlier than the APIs so we could be ready for the switch at least on the day of.

childish-sambino commented 1 year ago

I'm not entirely against supporting extraneous fields, but it requires non-trivial changes to the upstream generator(s) in a short time window.

I'm hoping we'll be able to push a new release with the new fields sooner than 17th, and we should have a plan early next week.

childish-sambino commented 1 year ago

Planning to release a new version this week with these added fields. They will all be optional fields in this library, but MessageFlow will start being required on the backend around the 17th.

childish-sambino commented 1 year ago

The latest release now includes these properties: https://github.com/twilio/twilio-php/releases/tag/6.43.2