Webhooks API

Use our webhooks to have our widget POST address book data to any URL you choose. You might send the content to your own server or to a service like Zapier to handle the data on your behalf.

NB Be careful not to expose any private or secure data (like basic authentication) in the webhook URL. This URL is set in the CloudSponge object’s options and will be exposed in public.

To specify a webhook, add it to your call to cloudsponge.init. For example:

cloudsponge.init({
  webhooks: {
    // send the entire address book before it is displayed to the user
    beforeDisplayContacts: 'https://example.com/path/to/before/webhook/',
    // send the contacts that the user selected and submitted
    afterSubmitContacts: 'https://example.com/path/to/after/webhook/'
  }
})

Available webhooks:

WebHookDescription
beforeDisplayContactsPosted before the user sees their address book in the widget. See a working example here.
afterSubmitContactsPosted after the user submits their selected contacts in our widget. Example.

Our webhooks send this payload structure:

{
    "contacts": [arrayOfContacts],
    "source": stringSource,
    "owner": ownerContact
}

The value of stringSource indicates the source of the address book. It will be one of the codes from our list of supported soures. arrayOfContacts and ownerContact both follow our standard contact data structure.