Title: Reply through REST API do not send notification
Last modified: November 18, 2018

---

# Reply through REST API do not send notification

 *  Resolved [swarnat](https://wordpress.org/support/users/swarnat/)
 * (@swarnat)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/reply-through-rest-api-do-not-send-notification/)
 * Hy,
 * During Implementation I recognize, that a Ticket Reply, created over REST API,
   do not send a email notification to client or agent.
 * I use Version 5.8.0 and latest WordPress 4.9.8.
 * Reason for this issue is, the way you check if a notification is necessary.
    
   Function wpas_notify_reply checks is ID of $data is set, which means it is an
   update. In case of REST API you set the complete Post Data into the second parameter,
   so isset($data[“ID”]) will always be true.
 * I repair this in an unconventionally way in API/TicketReplies.php function update_additional_fields_for_object,
   so check if it is Update or Create. When Create I remove the ID value. I’m sure
   you found a better bugfix.
 *     ```
       protected function update_additional_fields_for_object( $object, $request ) {
   
       	$data = get_post( $object->ID, 'ARRAY_A' );
   
       	/**
       	 * Delete the activity transient.
       	 */
       	delete_transient( "wpas_activity_meta_post_" . $object->ID );
   
       	/**
       	 * Fire wpas_add_reply_after after the reply was successfully added.
       	 */
       	do_action( 'wpas_add_reply_after', $object->ID, $data );
   
       	/** This fix the problem **/
       	if($request->get_param('id') === null) {
       		unset($data['ID']);
       	}
   
       	/**
       	 * Fire wpas_add_reply_complete after the reply and attachments was successfully added.
       	 */
       	do_action( 'wpas_add_reply_complete', $object->ID, $data );
   
       	return parent::update_additional_fields_for_object( $object, $request );
       }
       ```
   
    -  This topic was modified 7 years, 6 months ago by [swarnat](https://wordpress.org/support/users/swarnat/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [melliesou](https://wordpress.org/support/users/melliesou/)
 * (@melliesou)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/reply-through-rest-api-do-not-send-notification/#post-11005405)
 * Hi [@swarnat](https://wordpress.org/support/users/swarnat/),
 * Thanks for detailing your answer here with your proposed solution. As this is
   a code improvement update, it may make sense to contribute this to an issue discussion
   in our GitHub repo: [https://github.com/Awesome-Support/Awesome-Support/issues](https://github.com/Awesome-Support/Awesome-Support/issues)
 * Please let me know if I can help you with anything else.

Viewing 1 replies (of 1 total)

The topic ‘Reply through REST API do not send notification’ is closed to new replies.

 * ![](https://ps.w.org/awesome-support/assets/icon-256x256.png?rev=1849681)
 * [Awesome Support - WordPress HelpDesk & Support Plugin](https://wordpress.org/plugins/awesome-support/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/awesome-support/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/awesome-support/)
 * [Active Topics](https://wordpress.org/support/plugin/awesome-support/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/awesome-support/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/awesome-support/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [melliesou](https://wordpress.org/support/users/melliesou/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/reply-through-rest-api-do-not-send-notification/#post-11005405)
 * Status: resolved