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,
|
||||
'detail' => array( '#type' => 'item',
|
||||
'#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' ][ '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 ) ) ),
|
||||
);
|
||||
}
|
||||
|
@ -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' ) );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user