Contents |
URL
https://api.geoloqi.com/1/group/message/:token
Description
Publish a message to a group. The message will be delivered via the Streaming API if anyone is subscribed, and can optionally send a push notification to one or more users in the group as well.
Supported Request Methods
POST
Parameters
- push OptionalIf set, this will send a push notification to all members of the group. See below for the various options for this value.
- text Required if push is setThe message text to show in the push notification.
- url OptionalIf sending a push notification, this URL will be sent as the "view" action of the notification. This can be used to open your app to a specific screen by using custom URL scheme handlers.
- Any other parameters you send will be delivered through the streaming API.
Push Values
- true: The push notification will be sent to all members of the group. (Note: Must be sent as JSON in order for a boolean "true" value to be sent)
- user_id: If set to a single string value, it's interpreted as a user ID and the push will be sent to just the specified user.
- ["user1", "user2", "user3"]: If set to an array, the push notification will be sent to all users listed in the array.
Example Request
Sending a push to all members of the group:
$ curl https://api.geoloqi.com/1/group/message/d6Qwh1eSy \ -H "Authorization: OAuth Log in to get your personal access token" \ -H "Content-type: application/json" \ -d '{"push": true, "text": "Hello everyone!"}'
Sending a push to a single member of the group:
$ curl https://api.geoloqi.com/1/group/message/d6Qwh1eSy \ -H "Authorization: OAuth Log in to get your personal access token" \ -H "Content-type: application/json" \ -d '{"push": "UUU", "text": "Hello!"}'
Sending a push to one or more members of the group:
$ curl https://api.geoloqi.com/1/group/message/d6Qwh1eSy \ -H "Authorization: OAuth Log in to get your personal access token" \ -H "Content-type: application/json" \ -d '{"push": ["UUU","XXX","YYY"], "text": "Hello everyone!"}'
If you are not sending a JSON body, you will only be able to send to a single member of the group:
$ curl https://api.geoloqi.com/1/group/message/d6Qwh1eSy \ -H "Authorization: OAuth Log in to get your personal access token" \ -d "push=UUU" -d "text=Hello!"