Changeset 3771693 for joinotify/trunk/admin/src/Api/Webhook_Handler.php
- Timestamp:
- 10/28/2026 09:22:17 PM (7 days ago)
- File:
-
- 1 edited
-
joinotify/trunk/admin/src/Api/Webhook_Handler.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
joinotify/trunk/admin/src/Api/Webhook_Handler.php
r3678949 r3771693 101 101 * Record what actually happened to a message that was accepted earlier. 102 102 * 103 * @since 2.3.0 103 * Each transition also leaves its time in the row's `delivery` details, so 104 * a message that was read still shows when it was delivered. A refusal for 105 * a closed 24-hour window marks the row as sent outside it, whatever the 106 * send path knew at the time. 107 * 108 * @since 2.3.0 109 * @version 2.6.0 104 110 * @param array $status | Single status entry. 105 111 * @return void … … 114 120 115 121 $error = ''; 122 $timestamp = (int) ( $status['timestamp'] ?? 0 ); 123 124 $meta = array( 125 'delivery' => array( 126 $state . '_at' => gmdate( 'Y-m-d H:i:s', $timestamp > 0 ? $timestamp : time() ), 127 ), 128 ); 116 129 117 130 if ( 'failed' === $state ) { 118 131 $first = isset( $status['errors'][0] ) && is_array( $status['errors'][0] ) ? $status['errors'][0] : array(); 119 132 $error = (string) ( $first['title'] ?? $first['message'] ?? 'delivery_failed' ); 133 134 if ( Send_Error::WINDOW_CLOSED_META_CODE === (int) ( $first['code'] ?? 0 ) ) { 135 $meta['session_window'] = 'closed'; 136 } 120 137 121 138 Debug_Log::record( array( … … 134 151 // transitions are worth writing back. 135 152 if ( in_array( $state, array( 'delivered', 'read', 'failed' ), true ) ) { 136 Message_History::update_status_by_wamid( $wamid, $state, $error );153 Message_History::update_status_by_wamid( $wamid, $state, $error, $meta ); 137 154 } 138 155 } … … 168 185 * 169 186 * @since 2.3.0 187 * @version 2.6.0 170 188 * @param string $phone | Contact phone number. 171 189 * @return void … … 179 197 180 198 set_transient( self::WINDOW_PREFIX . md5( $phone ), time(), DAY_IN_SECONDS ); 199 200 // The platform has just seen the message too; the next read asks it again. 201 Contact_Window::forget( $phone ); 181 202 } 182 203
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)