Created
April 29, 2021 02:47
-
-
Save DeveloperWil/febc200640d774829260dcd7cd5b27fe to your computer and use it in GitHub Desktop.
Gravity Forms: Form Submission to Amazon Echo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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