Docs menu
onPostPublish
What your page receives when the user presses Publish.
Available in both createPost and editPost. Called when the user presses Publish in the editor.
Usage
gnr.createPost({
onPostPublish: function (error, data) {
if (error) console.error(error);
else console.log(data.media_url, data.caption);
},
});Parameters
| Name | Description | Type |
|---|---|---|
error | An error, or null. | Object |
data.media_url | The published media: one address for single_image and video, several for carousel. JPG or MP4. | Array |
data.post_id | The post's id — use it with editPost or get_posts. | String |
data.thumb_url | A thumbnail. | String |
data.media_type | single_image, carousel or video. | String |
data.caption | The caption, with its hashtags. | String |
data.ai_generated | true when AI wrote the words or made the picture. Show platforms' AI label when you post it. | Boolean |
💡 Tip
Publish only happens for posts that passed the checks. If a user's edit breaks a rule — an invented number, say — the editor tells them what to fix first.