begin making the webhook endpoint
This commit is contained in:
parent
b197c92c8d
commit
55975f03dc
@ -33,11 +33,13 @@ function fulcrm_webhook_admin_form( $form, &$form_state ) {
|
|||||||
'#collapsed' => FALSE,
|
'#collapsed' => FALSE,
|
||||||
'detail' => array( '#type' => 'item',
|
'detail' => array( '#type' => 'item',
|
||||||
'#title' => '',
|
'#title' => '',
|
||||||
'#markup' => '<p>You need to enable SSL on this Drupal instance to continue.</p><p>fulcrm will only send data to HTTPS webhooks.</p>' ),
|
'#markup' => ( '<p>You need to enable SSL on this Drupal site to continue.</p>' .
|
||||||
|
'<p>fulcrm will only send data to HTTPS webhooks.</p>' ),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
$form[ 'actions' ] = array( '#type' => 'actions' );
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
||||||
$form[ 'actions' ][ 'save' ] = array( '#type' => 'link',
|
$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 ) ) ),
|
'#href' => str_replace( 'http://', 'https://', url( 'admin/config/services/fulcrm/webhook', array( 'absolute' => TRUE ) ) ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,25 @@ function fulcrm_webhook_menu() {
|
|||||||
*/
|
*/
|
||||||
$items[ 'admin/config/services/fulcrm/webhook' ] = array( 'page callback' => 'fulcrm_webhook_admin',
|
$items[ 'admin/config/services/fulcrm/webhook' ] = array( 'page callback' => 'fulcrm_webhook_admin',
|
||||||
'file' => 'fulcrm_webhook.admin.inc',
|
'file' => 'fulcrm_webhook.admin.inc',
|
||||||
'title' => 'fulcrm webhook',
|
'title' => 'fulcrm webhooks',
|
||||||
'description' => 'Configuring webhooks for fulcrm.org.',
|
'description' => 'Configure webhooks for fulcrm.org.',
|
||||||
'access callback' => 'user_access',
|
'access callback' => 'user_access',
|
||||||
'access arguments' => array('administer fulcrm webhooks'),
|
'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;
|
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' ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user