Hi there! We are back with the third and final post on images in Kaizala. In this post, we will talk about Kaizala media resources and how we can send an announcement with media through REST APIs from Postman.
What is a Kaizala Media resource?
Kaizala media resource is a AES-encrypted base64 encoding of an image. This is used by Kaizala for sending media through APIs. Media Resource strings are different from the base64 encoding because Kaizala provides an extra AES encryption on top of the base64 encoded image. To send an announcement with media (images/video), a user needs to first generate the media resource before using it to send the announcement.
How to generate a media resource programmatically?
Kaizala provides a REST API to generate a media resource from a Public URL of an image. Following is the API signature for the same:
Below is the Postman screenshot of the above API. Once the API is triggered, Kaizala has returned the media resource of the URL that was sent as the request.
Note that URL in the request body has to be public – meaning there should not be a requirement to login to a site to fetch the image.
How to attach the media URL as part of an attachment?
Once the media resource is generated, use the send announcement API to attach the media resource with an announcement. The API accepts an array of media resources as shown below:
In all the API definitions above, elements in curly / squiggly brackets need to be replaced as follows:
- endpoint-url is present in the response to generate accessToken call.
- test-group-id is the id of the Group on which you want to send the reminder.
- access-token is required for authentication. If you are not familiar, please refer Getting started with Kaizala APIs.
A similar post where we have used Flow to send a document is here. So, whenever there is a need to send any media through API, the media has to be converted to a media resource and sent out to Kaizala via API.
Thank you for reading; hope it was helpful. If you have any comments / feedback, please let us know by commenting on this post. If you have any new REST API requirement, please reach out to email@example.com with your scenario.