Skip to main content

Push notifications Webhook

This webhook sends the payload data of a push notification to your endpoint.

Headers#

HeaderDescription
Content-typeapplication/json
X-SignatureThe HMAC hash to verify the webhook integrity. Optional (more info on Security).

Payload#

FieldTypeDescription
typestringfcm_notification_sent
platformstringandroid, ios or web (not implemented).
occurred_ondatetimeThe moment the event happened, using ISO8601 extended format (Y-m-d\TH:i:sO).
payloadobjectThe body you must sent to firebase using its Legacy API.

Android push notification examples#

Without notification object (default)#

{
"type": "fcm_notification_sent",
"platform": "android",
"occurred_on": "2024-07-17T10:17:23+00:00",
"payload": {
"user_id": "12345678X",
"fcm_http_legacy": {
"to": "FIREBASE-PUSH-TOKEN",
"registration_ids": null,
"data": {
"data": "{\"module\":\"consultations\",\"type\":\"message_created\",\"message\":{\"title\":\"Jes\\u00fas Casta\\u00f1eda\",\"body\":\"test\"},\"professional\":{\"hash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"name\":\"Jes\\u00fas Casta\\u00f1eda\",\"avatar\":\"https:\\/\\/files.demo.meetinglawyers.com\\/20210525090026_d6a9d0af-184a-4689-87da-09a183e9ba1a\"},\"customer\":{\"hash\":\"079e2a19-a14e-4172-ae83-b427ffba3387\"},\"message_payload\":{\"id\":9316,\"messageId\":\"d07b82a0-845a-47a1-8bdb-ffe229a09d5b\",\"roomId\":286,\"string\":\"test\",\"status\":1,\"auto\":1,\"fromUserHash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"type\":\"string\",\"createdAt\":\"2024-07-17T10:17:23+00:00\",\"time\":1721211443000},\"room_id\":286,\"notification_type\":\"chat_message\",\"source\":\"meetinglawyers\",\"id\":\"4df3a2bb-3802-4331-a0b4-16511e662e4a\"}"
},
"priority": "high"
},
"fcm_http_v1": {
"message": {
"data": {
"data": "{\"module\":\"consultations\",\"type\":\"message_created\",\"message\":{\"title\":\"Jes\\u00fas Casta\\u00f1eda\",\"body\":\"test\"},\"professional\":{\"hash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"name\":\"Jes\\u00fas Casta\\u00f1eda\",\"avatar\":\"https:\\/\\/files.demo.meetinglawyers.com\\/20210525090026_d6a9d0af-184a-4689-87da-09a183e9ba1a\"},\"customer\":{\"hash\":\"079e2a19-a14e-4172-ae83-b427ffba3387\"},\"message_payload\":{\"id\":9316,\"messageId\":\"d07b82a0-845a-47a1-8bdb-ffe229a09d5b\",\"roomId\":286,\"string\":\"test\",\"status\":1,\"auto\":1,\"fromUserHash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"type\":\"string\",\"createdAt\":\"2024-07-17T10:17:23+00:00\",\"time\":1721211443000},\"room_id\":286,\"notification_type\":\"chat_message\",\"source\":\"meetinglawyers\",\"id\":\"4df3a2bb-3802-4331-a0b4-16511e662e4a\"}"
},
"token": "FIREBASE-PUSH-TOKEN"
}
}
}
}

With notification object#

{
"type": "fcm_notification_sent",
"platform": "android",
"occurred_on": "2024-07-17T10:17:23+00:00",
"payload": {
"user_id": "12345678X",
"fcm_http_legacy": {
"to": "FIREBASE-PUSH-TOKEN",
"registration_ids": null,
"notification": {
"title": "Jesús Castañeda",
"body": "test",
"icon": "https://files.demo.meetinglawyers.com/20210525090026_d6a9d0af-184a-4689-87da-09a183e9ba1a",
"sound": "default"
},
"data": {
"data": "{\"module\":\"consultations\",\"type\":\"message_created\",\"message\":{\"title\":\"Jes\\u00fas Casta\\u00f1eda\",\"body\":\"test\"},\"professional\":{\"hash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"name\":\"Jes\\u00fas Casta\\u00f1eda\",\"avatar\":\"https:\\/\\/files.demo.meetinglawyers.com\\/20210525090026_d6a9d0af-184a-4689-87da-09a183e9ba1a\"},\"customer\":{\"hash\":\"079e2a19-a14e-4172-ae83-b427ffba3387\"},\"message_payload\":{\"id\":9316,\"messageId\":\"d07b82a0-845a-47a1-8bdb-ffe229a09d5b\",\"roomId\":286,\"string\":\"test\",\"status\":1,\"auto\":1,\"fromUserHash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"type\":\"string\",\"createdAt\":\"2024-07-17T10:17:23+00:00\",\"time\":1721211443000},\"room_id\":286,\"notification_type\":\"chat_message\",\"source\":\"meetinglawyers\",\"id\":\"4df3a2bb-3802-4331-a0b4-16511e662e4a\"}"
},
"priority": "high"
},
"fcm_http_v1": {
"message": {
"data": {
"data": "{\"module\":\"consultations\",\"type\":\"message_created\",\"message\":{\"title\":\"Jes\\u00fas Casta\\u00f1eda\",\"body\":\"test\"},\"professional\":{\"hash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"name\":\"Jes\\u00fas Casta\\u00f1eda\",\"avatar\":\"https:\\/\\/files.demo.meetinglawyers.com\\/20210525090026_d6a9d0af-184a-4689-87da-09a183e9ba1a\"},\"customer\":{\"hash\":\"079e2a19-a14e-4172-ae83-b427ffba3387\"},\"message_payload\":{\"id\":9316,\"messageId\":\"d07b82a0-845a-47a1-8bdb-ffe229a09d5b\",\"roomId\":286,\"string\":\"test\",\"status\":1,\"auto\":1,\"fromUserHash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"type\":\"string\",\"createdAt\":\"2024-07-17T10:17:23+00:00\",\"time\":1721211443000},\"room_id\":286,\"notification_type\":\"chat_message\",\"source\":\"meetinglawyers\",\"id\":\"4df3a2bb-3802-4331-a0b4-16511e662e4a\"}"
},
"token": "FIREBASE-PUSH-TOKEN"
}
}
}
}

Note: With this type of payload (notification + data), if app is closed or in the background, "data" is received in the intent extras, and you must pass it to the sdk using onNotificationDataReceived instead of onFirebaseMessageReceived, like this example does:

if (intent.hasExtra("data")) intent.getStringExtra("data").let {
MeetingLawyersClient.instance?.onNotificationDataReceived(it)
}

iOS push notification example#

{
"type": "fcm_notification_sent",
"platform": "ios",
"occurred_on": "2024-07-17T10:17:23+00:00",
"payload": {
"user_id": "12345678X",
"fcm_http_legacy": {
"to": "FIREBASE-PUSH-TOKEN",
"registration_ids": null,
"notification": {
"title": "Jesús Castañeda",
"body": "test",
"icon": "https://files.demo.meetinglawyers.com/20210525090026_d6a9d0af-184a-4689-87da-09a183e9ba1a",
"sound": "default"
},
"data": {
"data": "{\"module\":\"consultations\",\"type\":\"message_created\",\"message\":{\"title\":\"Jes\\u00fas Casta\\u00f1eda\",\"body\":\"test\"},\"professional\":{\"hash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"name\":\"Jes\\u00fas Casta\\u00f1eda\",\"avatar\":\"https:\\/\\/files.demo.meetinglawyers.com\\/20210525090026_d6a9d0af-184a-4689-87da-09a183e9ba1a\"},\"customer\":{\"hash\":\"079e2a19-a14e-4172-ae83-b427ffba3387\"},\"message_payload\":{\"id\":9316,\"messageId\":\"d07b82a0-845a-47a1-8bdb-ffe229a09d5b\",\"roomId\":286,\"string\":\"test\",\"status\":1,\"auto\":1,\"fromUserHash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"type\":\"string\",\"createdAt\":\"2024-07-17T10:17:23+00:00\",\"time\":1721211443000},\"room_id\":286,\"notification_type\":\"chat_message\",\"source\":\"meetinglawyers\",\"id\":\"4df3a2bb-3802-4331-a0b4-16511e662e4a\"}"
},
"priority": "high",
"content_available": true,
"mutable_content": true
},
"fcm_http_v1": {
"message": {
"data": {
"data": "{\"module\":\"consultations\",\"type\":\"message_created\",\"message\":{\"title\":\"Jes\\u00fas Casta\\u00f1eda\",\"body\":\"test\"},\"professional\":{\"hash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"name\":\"Jes\\u00fas Casta\\u00f1eda\",\"avatar\":\"https:\\/\\/files.demo.meetinglawyers.com\\/20210525090026_d6a9d0af-184a-4689-87da-09a183e9ba1a\"},\"customer\":{\"hash\":\"079e2a19-a14e-4172-ae83-b427ffba3387\"},\"message_payload\":{\"id\":9316,\"messageId\":\"d07b82a0-845a-47a1-8bdb-ffe229a09d5b\",\"roomId\":286,\"string\":\"test\",\"status\":1,\"auto\":1,\"fromUserHash\":\"e27a691a-e1d6-4e8d-92c5-b1537e066b83\",\"type\":\"string\",\"createdAt\":\"2024-07-17T10:17:23+00:00\",\"time\":1721211443000},\"room_id\":286,\"notification_type\":\"chat_message\",\"source\":\"meetinglawyers\",\"id\":\"4df3a2bb-3802-4331-a0b4-16511e662e4a\"}"
},
"token": "FIREBASE-PUSH-TOKEN"
}
}
}
}

Web push notification example#

Not implemented