Trigger Twilio Feed

Trigger a Twilio feed via Notification Scheduler.

Instructions

  1. Setup your Twilio feed. a. In the “Name” setting of your Twilio feed include the following string “twilio.FID@notificationscheduler.com”. b. Replace “FID” with your Twilio feed’s ID. You can find this in the URL via the “fid” parameter.
  2. Setup your scheduled notification. a. Set the “Send To Email” to the same string you included in your Twilio feed’s name (e.g.
     "twilio.FID@notificationscheduler.com" with the FID replaced with your actual FID).
    

    b. Configure your desired schedule with Notification Scheduler’s “Schedule” setting. c. The notification has other required fields. Fill them out however you wish. They will not be used.

When the scheduled notification is sent, the actual email will be aborted and the Twilio feed will be sent instead.

Code

Filename: gpns-twillio.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
 * Gravity Perks // Notification Scheduler // Trigger Twilio Feed
 * https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/
 *
 * Use a scheduled notification to trigger a Twilio feed instead.
 *
 * Instruction Video: https://www.loom.com/share/58faeab7b4884ccbb177fa3e30c9587e
 *
 * Instructions:
 *
 *  1. Setup your Twilio feed.
 *      a. In the "Name" setting of your Twilio feed include the following string "twilio.FID@notificationscheduler.com".
 *      b. Replace "FID" with your Twilio feed's ID. You can find this in the URL via the "fid" parameter.
 *  2. Setup your scheduled notification.
 *      a. Set the "Send To Email" to the same string you included in your Twilio feed's name (e.g.
 *          "twilio.FID@notificationscheduler.com" with the FID replaced with your actual FID).
 *      b. Configure your desired schedule with Notification Scheduler's "Schedule" setting.
 *      c. The notification has other required fields. Fill them out however you wish. They will not be used.
 *
 * When the scheduled notification is sent, the actual email will be aborted and the Twilio feed will be sent instead.
 *
 * Plugin Name:  GP Notification Scheduler — Twilio
 * Plugin URI:   https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/
 * Description:  Trigger a Twilio feed via Notification Scheduler.
 * Author:       Gravity Wiz
 * Version:      0.1
 * Author URI:   https://gravitywiz.com
 */
add_filter( 'gform_gravityformstwilio_pre_process_feeds', function( $feeds ) {

	$filtered = array();

	foreach ( $feeds as $feed ) {
		if ( ! preg_match( '/twilio(?:.([0-9]+))@notificationscheduler.com/', $feed['meta']['feedName'], $match ) ) {
			$filtered[] = $feed;
		}
	}

	return $filtered;
} );

add_filter( 'gform_pre_send_email', function( $email, $message_format, $notification, $entry ) {

	// Only intercept emails sent via Notification Scheduler.
	if ( ! doing_action( 'gpns_cron' ) ) {
		return $email;
	}

	if ( ! preg_match( '/twilio(?:.([0-9]+))@notificationscheduler.com/', $notification['toEmail'], $match ) ) {
		return $email;
	}

	$email['abort_email'] = true;

	$twilio_feed = gf_twilio()->get_feed( (int) $match[1] );
	if ( $twilio_feed ) {
		gf_twilio()->process_feed( $twilio_feed, $entry, GFAPI::get_form( $entry['form_id'] ) );
	}

	return $email;
}, 10, 4 );

Comments

  1. Julia
    Julia July 23, 2026 at 7:56 am

    Since I have updated my website including the gravity forms plugin I cannot schedule Twilio SMS. The API is working, I can still receive sms without scheduling and without the snippet in my function.php. Logs says it finds the feed, but has 0 after filters. When I remove the snippet from my functions.php it sends sms (without scheduling of course). Please help!

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff July 23, 2026 at 11:16 am

      Hi Julia,

      Sorry about the issue you’re experiencing. I will be contacting you via email to request additional information so we can reproduce the issue and have it fixed.

      Best,

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.