I am trying to send a richLink with the Apple Business Chat Sandbox. However I am not able to find out what the correct payload is. The sandbox does not provide a predefined payload for a richLink. Therefore I am using the RAW JSON tab in order to send a richLink.
The example from the apple documentation is not working and I think there are certain parts missing. Does anyone know what information is missing?
{
"richLinkData": {
"url": "https://www.apple.com/ipad-pro",
"title": "iPad Pro",
"assets": {
"image": {
"data": "/9j/4AAQSkZJRgABAQA…………<snipped>…………AAQAB/Z",
"mimeType": "image/jpeg"
}
}
}
}
The example Apple provides is only part of the solution. You must include the additional parameters that are required in an iMessage. The other required parameters are:
The different types can be found here, but for richLinkData we set it to
richLink
.Here is an example with all the necessary parameters minus the
data
parameter.Copying and pasting this exactly won't work on it's own. You'll need to fill in the
data
parameter. Thedata
field they provide won't work, because it has been truncated. To use an image of your choice, you will need to fill the data field with the base64 encoding of your image. You can go here to encode your image, but any base64 image encoder will work. You'll want to cut outdata:image/jpeg;base64,
because that portion is written for<img>
elements. If you don't care about having an image, you can just delete the entireassets
parameter.