Module: webhooks

webhooks

API for interacting with Jive communities.

Source:

Methods

<static> findByCommunity(community) → {Promise}

Looks through persistence for all webhooks associated with the provided community object. If no objects are found with that id, an empty array is resolved to the returned promise; otherwise an array of objects is resolved.

An error will be thrown if:

  • No community argument is passed
  • Community argument is not an object
  • Community object does not contain a tenantId
Parameters:
Name Type Description
community
Source:
Returns:

Promise

Type
Promise

<static> findByID(webhookId) → {Promise}

Looks through persistence for a webhook object with the provided id. If no object is found with that id, a null object is resolved to the returned promise.

Parameters:
Name Type Description
webhookId
Source:
Returns:

Promise

Type
Promise

<static> findByTenantID(tenantId) → {Promise}

Looks through persistence for any webhook objects related to the provided tenantId.

An error will be thrown if, tenantId is not found in the webhook persistence store.

Parameters:
Name Type Description
tenantId
Source:
Returns:

Promise (webhook)

Type
Promise

<static> findByWebhookURL(webhookURL) → {Promise}

Looks through persistence for a webhook object with the provided webhookURL.

An error will be thrown if, webhookURL is not found in the webhook persistence store.

Parameters:
Name Type Description
webhookURL
Source:
Returns:

Promise (webhook)

Type
Promise

<static> findWebhookCommunity(webhook) → {Promise}

Uses a webhook object to resolve reference to its parent community. This is a convenience method for webhook processing.

An error will be thrown if, community tenantId is not found in the community persistence store.

Parameters:
Name Type Description
webhook

object

Source:
Returns:

Promise (community)

Type
Promise

<static> register(jiveCommunity, events, object, webhookCallbackURL, accessToken, refreshToken, tokenPersistenceFunction) → {Promise}

Register a webhook for the named jive community. Uses either the registered community access token for your service, or the supplied access token.

Parameters:
Name Type Description
jiveCommunity String

Required. Name of the jive community.

events Array

Required. Array of String. Elements may be system webhooks (user_account, user_membership, user_session, social_group) or content events (document, discussion, blogpost, .. )

object String

Optional, if events are system webhooks.

webhookCallbackURL String

Required. URL of the postback that Jive will contact when the conditions of the hook are met.

accessToken String

Optional. If omitted, will registration will use community oauth

refreshToken String

Optional. If omitted, will registration will use community oauth

tokenPersistenceFunction function

Optional. Callback function that will be invoked with new oauth access and refresh tokens ({'access_token' : '...', 'refresh_token' : '...' }). If not provided, the community will be updated with the new access tokens.

Source:
Returns:

Promise

Type
Promise

<static> save(webhook) → {Promise}

Saves the given webhook into persistence.

Parameters:
Name Type Description
webhook
Source:
Returns:

Promise

Type
Promise