Webhooks

Automatic translation. View original

Subscription

A subscription has:

  • url

  • account

  • event

  • list (soon)

Once a URL is subscribed to one of the Events available, we will send a POST to that url each time the event occurs within the account.

soon: If there is an associated list, the hook only triggers for contacts included in the list

Events

staff note: see HookSubscription::VALID_EVENTS

These are the currently available events:

  • contact_created - When a contact is created

  • contact_updated - When a contact is modified

  • enrollment_created - When a student is enrolled

  • dropout_created - When a student drops out

  • communication_created - When a communication is registered with a contact.

Payload

staff note: see Contacts::Contact#as_json

Currently all events send the same payload in the body in JSON format

{
	padma_id: "xx",
	friendly_name: "Vicky",
	first_name: "Maria Victoria",
	last_name: "Sanchez",
	level: "sádhaka",
	email: "secret@info.com",
	phone: "12341234",
	in_professional_trainning: true,
	...
}

ACTIONS / ENDPOINTS

Create a subscription

POST https://crm.derose.app/api/v1/hook_subscriptions

This endpoint registers an address to receive the payload every time the event occurs on your account.

Parameters

  • api_key
  • hook_subscription_event
  • hook_subscription_url

Response

HTTP status: 201

JSON Body:

{"id": subscription_id}

Cancel subscription

DELETE https://crm.derose.app/api/v1/hook_subscriptions/:id

Parameters

  • api_key

Response

HTTP Status: 200

Body:

"destroyed"

View subscription

GET https://crm.derose.app/api/v1/hook_subscriptions/:id

Parameters

  • api_key

Response

HTTP Status: 200

Body:

{
	"id": 2222,
	"url": "https://your-url.com/webhooks",
	"event": "enrollment_created"
}

Back to CRM API

Contact support