diff --git a/fulcrm_webhook.admin.inc b/fulcrm_webhook.admin.inc index eedeb9c..37b082c 100644 --- a/fulcrm_webhook.admin.inc +++ b/fulcrm_webhook.admin.inc @@ -33,11 +33,13 @@ function fulcrm_webhook_admin_form( $form, &$form_state ) { '#collapsed' => FALSE, 'detail' => array( '#type' => 'item', '#title' => '', - '#markup' => '

You need to enable SSL on this Drupal instance to continue.

fulcrm will only send data to HTTPS webhooks.

' ), + '#markup' => ( '

You need to enable SSL on this Drupal site to continue.

' . + '

fulcrm will only send data to HTTPS webhooks.

' ), + ), ); $form[ 'actions' ] = array( '#type' => 'actions' ); $form[ 'actions' ][ 'save' ] = array( '#type' => 'link', - '#title' => t('Reload'), + '#title' => t('Reload with SSL'), '#href' => str_replace( 'http://', 'https://', url( 'admin/config/services/fulcrm/webhook', array( 'absolute' => TRUE ) ) ), ); } diff --git a/fulcrm_webhook.module b/fulcrm_webhook.module index ca5cd7c..7c801d3 100644 --- a/fulcrm_webhook.module +++ b/fulcrm_webhook.module @@ -21,12 +21,25 @@ function fulcrm_webhook_menu() { */ $items[ 'admin/config/services/fulcrm/webhook' ] = array( 'page callback' => 'fulcrm_webhook_admin', 'file' => 'fulcrm_webhook.admin.inc', - 'title' => 'fulcrm webhook', - 'description' => 'Configuring webhooks for fulcrm.org.', + 'title' => 'fulcrm webhooks', + 'description' => 'Configure webhooks for fulcrm.org.', 'access callback' => 'user_access', 'access arguments' => array('administer fulcrm webhooks'), ); + $items[ 'services/fulcrm/webhook/%' ] = array( 'page callback' => 'fulcrm_webhook_webhook', + 'page arguments' => array(3), + 'type' => MENU_CALLBACK, + 'access callback' => 'user_access', + 'access arguments' => array('access content'), + ); return $items; } +function fulcrm_webhook_webhook( $uuid ) { + if ( $uuid === variable_get( 'fulcrm_webhook_url' ) ) { + drupal_json_output( array( 'status' => 'ok' ) ); + } else { + drupal_json_output( array( 'error' => 'incorrect webhook UUID' ) ); + } +}