Webhooks
Found Hero uses webhooks to notify your application when the status of the lost item changes. You can subscribe to our webhooks to receive important updates related to your lost items.
Setting up webhooks
To subscribe to Found Hero webhooks, follow the following steps:
Create a webhook endpoint at your server.
Login to your Found Hero account.
Go to the account settings page and then open the "Webhooks" tab.
Register the webhook endpoint with Found Hero.
By ready to receive notifications.
When you register a webhook endpoint, Found Hero sends an HTTP POST request to the URL to verify if it is valid. For a valid webhook URL, Found Hero expects HTTP 200 status code.
Event types
At the moment, Found Hero supports the following events:
Event
Description
pickup
This event is sent when the owner chooses to pick up the lost item by himself.
discard
This event is sent when the owner decides to leave the lost item behind.
donate
This event is sent when the owner asks to donate the lost item to a charity of your own choice.
shipping-label
This event is sent when the owner pays the shipping fees to get the lost item back.
request
This event is sent when a user creates a lost item request and claim that he lost an item in a specific location.
Receiving notifications
Whenever a new event happens, Found Hero will send an HTTP POST request to the webhook URL that you have configured in your account settings.
The Content-Type
of the request is set to application/json
and the body of the request is a JSON object that has the following properties:
Property
Type
Description
eventType
string
required
The type of event (pickup
, donate
, discard
, request
, or shipping-label
)
eventTime
string
required
payload
object
required
A JSON object that contains information about the event.
The payload
object contains the following properties:
Property
Type
Description
item
object
required
pickupDate
String
optional
The pick-up date in YYYY-MM-DD
format. Only available for pickup
events.
pickupTime
String
optional
The pick-up time in HH:mm
format. Only available for pickup
events.
shippingDate
String
optional
Ship date in YYYY-MM-DD
format. Only available for shipping-label
events.
serviceName
string
optional
The name of the courier service. Only available for shipping-label
events.
files
object
optional
A JSON object containing information about the shipping label and payment invoice. Only available for shipping-label
events.
For a typical shipping-label
event notification, the HTTP POST request body looks like the following:
Here is another example of the request body for pickup
event notification:
Securing webhooks
Each webhook request includes a secret signature in the fh-signature
header. You should use this HTTP request header to verify that the events were sent by Found Hero, and not by a third-party.
You can find your own secret signature under the "Webhooks" tab of your account settings. Make sure that you treat this signature as a secret password and never hard-code it into source control systems like Git.
Retrying webhooks
If the webhook endpoint does not return a 200 HTTP response code, Found Hero will attempt to deliver the event again up to 5 times in increasing interval: 2^number_of_fail x 15s.
For example, if the first attempt fails, Found Hero will retry the 2nd attempt after 15 seconds.
If the second attempt fails, the next attempt will be made after 60 seconds and so on.
Last updated