hopeonesource / dispatcher

This Drupal 8 module dispatches text messages/alert to the sms provider to send to service receipents. This module will be built with Drupal 8 methods (all of the logic and functionality), and include a plugin in the same module for Drupal 7 to connect with current Drupal 7 sites. All Drupal 8 sites will ignore the module's Drupal 7 plugin Hook.
1 stars 3 forks source link

Change status of Post to delivered #5

Open mmwebaze opened 6 years ago

mmwebaze commented 6 years ago

If a message has been confirmed as delivered, the Post status should be modified to delivered. In this case the use of published or unpublished might be preferred.

raubrey2014 commented 5 years ago

Each post should be identified by its Message SID in Twilio.

Once a message is queued (Twilio's API is hit to queue off an SMS message), the message can only be confirmed to have been delivered via the statusCallback: https://www.twilio.com/docs/sms/tutorials/how-to-confirm-delivery-php.

Goals for this story would be to:

  1. Attach a statusCallback 'option' to the SmsMessage, for 'statusCallback' => 'https://example.com/api/callback/'
  2. Create an API endpoint like the example.com url in 1, that can can accept the response from Twilio (as seen in attached screenshot, taken from the Twilio documentation)
  3. Parse the response from Twilio to get the SmsStatus and MessageStatus fields. Update the status of the Post accordingly. In the example screenshot, the status was confirmed as 'sent', so we might update the Post status to something like 'Delivered', etc.
screen shot 2018-11-16 at 2 40 00 pm