Use this endpoint to subscribe to a webhook.
Webhooks allow developers to subscribe to specific events. For example, a developer may want to be notified when a new listing is added, they would simply create a subscription for the listing.created event by sending the following request:
curl --request POST \ --url https://api.repliers.io/webhooks \ --header 'Authorization: {ACCOUNT-API_KEY}' \ --header 'content-type: application/json' \ --data '{"target_url":"https://someurl.com/unique-path","event":"listing.created"}'
Note: the target_url value must be unique.
Following a successful subscription, an empty POST request is immediately sent to the target_url containing an X-Hook-Secret header with a random value. In order to complete the subscription, the subscriber must return a 200 response to this post containing the same header key and value.
All subsequent requests to the specified target will contain the same value for the X-Hook-Secret header. Important! This value should be used to authenticate all subsequent requests.
Here's an example of the a POST request sent to the target_url after a successful subscription:
curl --request POST \ --url {target_url}\ --header 'X-Hook-Secret: {random-value}'
The following is a list of currently supported events that developers may subscribe to:
- agent.created
- agent.updated
- agent.deleted
- client.created
- client.updated
- client.deleted
- search.created
- search.updated
- search.deleted
- search.match.created
- search.match.updated
- message.created
- message.updated
- message.deleted
- listing.created
- listing.updated
- listing.deleted
Here's an example of a webhook request sent to a target_url when an agent is created:
curl --request POST \ --url {target_url} \ --header 'X-Hook-Secret: {some-value}' \ --header 'content-type: application/json' \ --data '[{"agentid": 909,"fname": "Mike","lname": "Jones","phone": "16475556666","email": "[email protected]","password":"DFSFDSDFSD","avatar":"http://abcrealestate.com/images/mikejones.jpg","status": true,"brokerage": "The Best Real Estate Brokerage","designation": "Broker","boards": [4442,3333,334,36]}]'
Repliers webhook resource was developed in accordance with REST hook specifications:
This value must be unique, you may not specify the same target url for more than one webhook.