Question:
I pass JSON in the data parameter of /createMessage, the push is delivered, but the custom data never arrives and /getMessageDetails shows data = <null>. Why?
Answer:
The request is structured incorrectly. data (like devices and users) belongs inside the object in the notifications array, not next to application/auth. Anything placed at the request root is ignored.
Correct Swift example:
let urlString = "https://api.pushwoosh.com/json/1.3/createMessage"
let parameters: [String: Any] = [
"request": [
"application": "ABCDE-12345",
"auth": "YOUR_API_TOKEN",
"notifications": [[
"send_date": "now",
"content": "Click to OK your payment",
"devices": ["qwertyuiop1234567890"],
"data": ["retailerUserid": "25"]
]]
]
]
Notes:
- The API host is
api.pushwoosh.com(or<APP_CODE>.api.pushwoosh.com). The oldcp.pushwoosh.comhost no longer serves the API. -
datais delivered to the device in theupayload key (exposed asuserdataby the SDKs). -
/createMessageis deprecated — new integrations should use Messaging API v2.
See Messages API and Using custom data.
Comments
0 comments
Please sign in to leave a comment.