curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"ids":"96831397"
},
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"push_type":"apns"
}
}' \
https://api.quickblox.com/events.json
{
"event": {
"id": 30961913,
"event_type": "one_shot",
"message": "payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"date": null,
"period": null,
"name": null,
"occured_count": 0,
"created_at": "2019-11-09T19:40:25Z",
"updated_at": "2019-11-09T19:40:25Z",
"end_date": null,
"active": true,
"application_id": 76730,
"user_id": 91142495,
"kind": "API",
"environment": "production",
"tag_query": null,
"notification_channel": {
"name": "apns"
}
}
}
Create Event
Create notification event.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"ids":"96831397"
},
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"push_type":"apns"
}
}' \
https://api.quickblox.com/events.json
{
"event": {
"id": 30961913,
"event_type": "one_shot",
"message": "payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"date": null,
"period": null,
"name": null,
"occured_count": 0,
"created_at": "2019-11-09T19:40:25Z",
"updated_at": "2019-11-09T19:40:25Z",
"end_date": null,
"active": true,
"application_id": 76730,
"user_id": 91142495,
"kind": "API",
"environment": "production",
"tag_query": null,
"notification_channel": {
"name": "apns"
}
}
}
Recipe
Create event
Create event
1. Use an `event` parameter to set data associated with the event
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
}
}' \
https://api.quickblox.com/events.json
2. Set a notification type
notication_type parameter to set the type of notification.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
}
}' \
https://api.quickblox.com/events.json
3. Set a push notification environment
environment parameter to set the notification environment.Here, the production environment is set which means the pushes will work for a production environment only.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
}
}' \
https://api.quickblox.com/events.json
4. Use a `user` parameter to set the ID of push notification recipient.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
},
}
}' \
https://api.quickblox.com/events.json
5. Set the ID of push notification recipient
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"ids":"96831397"
},
}
}' \
https://api.quickblox.com/events.json
6. Set a push message
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"ids":"96831397"
},
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
}
}' \
https://api.quickblox.com/events.json
7. Set a push notification platform
push_type parameter to set the push notification platform.Here, the push_type is set to apns. This means that the push will be delivered to iOS devices.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"ids":"96831397"
},
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"push_type":"apns"
}
}' \
https://api.quickblox.com/events.json
8. As a result, the API returns a newly created event.
{
"event": {
"id": 30961913,
"event_type": "one_shot",
"message": "payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"date": null,
"period": null,
"name": null,
"occured_count": 0,
"created_at": "2019-11-09T19:40:25Z",
"updated_at": "2019-11-09T19:40:25Z",
"end_date": null,
"active": true,
"application_id": 76730,
"user_id": 91142495,
"kind": "API",
"environment": "production",
"tag_query": null,
"notification_channel": {
"name": "apns"
}
}
}
Create event with period date
Create event with period date
1. Use an `event` parameter to set data associated with the event
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
}
}' \
https://api.quickblox.com/events.json
2. Set a notification type
notication_type parameter to set the type of notification.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
}
}' \
https://api.quickblox.com/events.json
3. Set a push notification environment
environment parameter to set the notification environment.Here, the production environment is set which means the pushes will work for a production environment only.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
}
}' \
https://api.quickblox.com/events.json
4. Set an event type
event_type method to set the event type.Here, the period_date event type is set. This event occurs within a given period from the initial date. Valid only if the period is specified.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"event_type":"period_date",
}
}' \
https://api.quickblox.com/events.json
5. Set a date of the event
date parameter to set the date for the event to be sent on.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"event_type":"period_date",
"date":"1567556125",
}
}' \
https://api.quickblox.com/events.json
6. Set a period of the event
period parameter to set the period of the event.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"event_type":"period_date",
"date":"1567556125",
"period":"86400",
}
}' \
https://api.quickblox.com/events.json
7. Set an end date of the event
end_date parameter to set the date for the event to end.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"event_type":"period_date",
"date":"1567556125",
"period":"86400",
"end_date":"1568556125",
}
}' \
https://api.quickblox.com/events.json
8. Set a push message
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"event_type":"period_date",
"date":"1567556125",
"period":"86400",
"end_date":"1568556125",
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
}
}' \
https://api.quickblox.com/events.json
9. Set a push notification platform
push_type parameter to set the push notification platform.Here, the push_type is set to apns. This means that the push will be delivered to iOS devices.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 1c3c3584d472a4416eca65df9474ed2cee012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"event_type":"period_date",
"date":"1567556125",
"period":"86400",
"end_date":"1568556125",
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"push_type":"apns"
}
}' \
https://api.quickblox.com/events.json
10. As a result, the API returns a newly created event.
{
"event": {
"id": 30534811,
"event_type": "period_date",
"message": "payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"date": 1567556125,
"period": 86400,
"name": null,
"occured_count": 1,
"created_at": "2019-09-02T20:29:55Z",
"updated_at": "2019-09-02T20:29:55Z",
"end_date": 1568556125,
"active": true,
"application_id": 76730,
"user_id": 91141808,
"kind": "API",
"environment": "production",
"tag_query": null,
"notification_channel": {
"name": "apns"
}
}
}
Create event for users with tags
Create event for users with tags
1. Use an `event` parameter to set data associated with the event
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
}
}' \
https://api.quickblox.com/events.json
2. Set a notification type
notication_type parameter to set the type of notification.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
}
}' \
https://api.quickblox.com/events.json
3. Set a push notification environment
environment parameter to set the notification environment.Here, the production environment is set which means the pushes will work for a production environment only.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
}
}' \
https://api.quickblox.com/events.json
4. Use a `user` parameter to set user tags.
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
}
},
}' \
https://api.quickblox.com/events.json
5. Use a `tags` parameter to set user tags
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"tags":{
}
}
},
}' \
https://api.quickblox.com/events.json
6. Set user tags
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"tags":{
"any":"web,android"
}
}
},
}' \
https://api.quickblox.com/events.json
7. Set a push message
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"tags":{
"any":"web,android"
}
},
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
},
}' \
https://api.quickblox.com/events.json
8. Set a push notification platform
push_type parameter to set the push notification platform.Here, the push_type is set to apns. This means that the push will be delivered to iOS devices.curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"tags":{
"any":"web,android"
}
},
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"push_type":"apns"
},
}' \
https://api.quickblox.com/events.json
9. As a result, the API returns a newly created event for users with the specified tags.
{
"event": {
"id": 30962142,
"event_type": "one_shot",
"message": "payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"date": null,
"period": null,
"name": null,
"occured_count": 0,
"created_at": "2019-11-09T20:40:25Z",
"updated_at": "2019-11-09T20:40:25Z",
"end_date": null,
"active": true,
"application_id": 76730,
"user_id": 91142495,
"kind": "API",
"environment": "production",
"tag_query": "{\"any\":\"web,android\"}",
"notification_channel": {
"name": "apns"
}
}
}
Body Parameters
push and email.notification_type=push, otherwise ignored. If not set, the notification will be delivered to all possible devices for specified users. Possible values are: apns, apns_voip, gcm.development and production.one_shot- a one-time event caused by an external object (valid only if thedateis not specified).fixed_date- a one-time event that occurs at a specified date (valid only if thedateis specified).period_date- is a reusable event that occurs within a given period from the initial date (valid only if theperiodis specified).
Default:one_shot- ifdateis not specified.period_date- ifperiodis specified.fixed_date- ifdateis specified.
Show properties
Show properties
Show properties
Show properties
Show external_user object
Show external_user object
event_type=fixed_date, the date can not be in the past.date.Headers
Responses
curl -X POST \
-H "Content-Type: application/json" \
-H "QB-Token: 519c40c31072fe5dcbe0c24651c7489fab012bba" \
-d '{
"event":{
"notification_type":"push",
"environment":"production",
"user":{
"ids":"96831397"
},
"message":"payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"push_type":"apns"
}
}' \
https://api.quickblox.com/events.json
{
"event": {
"id": 30961913,
"event_type": "one_shot",
"message": "payload=eyJhcHMiOnsiYWxlcnQiOiJIZWxsbywgV29ybGQhIiwiYmFkZ2UiOjc3Nywic291bmQiOiJkZWZhdWx0In19",
"date": null,
"period": null,
"name": null,
"occured_count": 0,
"created_at": "2019-11-09T19:40:25Z",
"updated_at": "2019-11-09T19:40:25Z",
"end_date": null,
"active": true,
"application_id": 76730,
"user_id": 91142495,
"kind": "API",
"environment": "production",
"tag_query": null,
"notification_channel": {
"name": "apns"
}
}
}
Was this page helpful?