Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DeveloperWil/febc200640d774829260dcd7cd5b27fe to your computer and use it in GitHub Desktop.

Select an option

Save DeveloperWil/febc200640d774829260dcd7cd5b27fe to your computer and use it in GitHub Desktop.

Revisions

  1. DeveloperWil created this gist Apr 29, 2021.
    20 changes: 20 additions & 0 deletions gravity-forms-submission-to-amazon-echo.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    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 );