Use our webhooks to have our contact picker 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:
WebHook | Description |
---|---|
beforeDisplayContacts |
Posted before the user sees their address book in the contact picker. See a working example here. |
afterSubmitContacts |
Posted after the user submits their selected contacts in our picker. Example. |
Our webhooks send this payload structure:
{
"import_id": "importId",
"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.