Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DeveloperWil/febc200640d774829260dcd7cd5b27fe to your computer and use it in GitHub Desktop.
Save DeveloperWil/febc200640d774829260dcd7cd5b27fe to your computer and use it in GitHub Desktop.
Gravity Forms: Form Submission to Amazon Echo
function gf_alexa_notification( $entry, $form ){
$notifyme_api_url = 'https://api.notifymyecho.com/v1/NotifyMe';
$notifyme_api_secret = '1234567890';
if( $form->ID === 12 ){
// Only for form ID=12
$firstname = rgar( $entry, '1.3' );
$lastname = rgar( $entry, '1.3' );
$phone = rgar( $entry, '2' );
$notification = $firstname . ' ' . $lastname . ' requested a callback on "' . $phone .'"';
$args = [
'notification' => $notification,
'accessCode' => $notifyme_api_secret,
];
$response = wp_remote_post( $notifyme_api_url, $args );
}
}
add_action( 'gform_after_submission', 'gf_alexa_notification', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment