Skip to main content
POST
/
events.json
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

1

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

2. Set a notification type

Use a 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

3. Set a push notification environment

Use an 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

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

5. Set the ID of push notification recipient

You can specify as many IDs as you need via comma.
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

6. Set a push message

A push message text should be Base64-encoded.Here, the iOS push message is set. For iOS push, you should add a payload before a 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

7. Set a push notification platform

Use a 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

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"
    }
  }
}
1

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

2. Set a notification type

Use a 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

3. Set a push notification environment

Use an 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

4. Set an event type

Use an 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

5. Set a date of the event

Use a 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

6. Set a period of the event

Use a 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

7. Set an end date of the event

Use an 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

8. Set a push message

A push message text should be Base64-encoded.Here, the iOS push message is set. For iOS push, you should add a payload before a 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

9. Set a push notification platform

Use a 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

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"
    }
  }
}
1

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

2. Set a notification type

Use a 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

3. Set a push notification environment

Use an 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

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

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

6. Set user tags

Specify as many tags as you need via comma.
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

7. Set a push message

A push message text should be Base64-encoded.Here, the iOS push message is set. For iOS push, you should add a payload before a 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

8. Set a push notification platform

Use a 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

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"
    }
  }
}
Only one of (Optional) parameters is required.

Body Parameters

notification_type
string
required
Type of notification. Possible values are: push and email.
push_type
string
Used only if 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.
environment
string
required
An environment of the notification. Possible values are: development and production.
event_type
string
Event type. Possible values are:
  • one_shot - a one-time event caused by an external object (valid only if the date is not specified).
  • fixed_date - a one-time event that occurs at a specified date (valid only if the date is specified).
  • period_date - is a reusable event that occurs within a given period from the initial date (valid only if the period is specified).
    Default:
  • one_shot - if date is not specified.
  • period_date - if period is specified.
  • fixed_date - if date is specified.
message
string
required
Encoded message payload. Possible values are: Base64 encoded plain text or push notification payload (Push notifications formats).
user
object
external_user
object
date
date-time
The date of the event to send on. If the event_type=fixed_date, the date can not be in the past.
end_date
date-time
The date when the event is completed. Must be not less than the date.
period
date-time
The period of the event in seconds.
name
string
The name of the event. Service information. Only for your own usage.

Headers

QB-Token
string
required
A user or application session token. See Authentication page to learn more about session tokens. Must be used either QB-Token or Authorization.

Responses

A successful response.
event
object
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"
    }
  }
}
I