Skip to main content

Configuring Webhooks

All the posts created via API have a lifecycle and take different states. The possible states that a post can take is inProgress, completed and error. Once a request is made to generate a post, the inProgress state is notified in the response itself. The remaining two states - completed and error will be notified via the webhooks configured by you.

Setup a Webhook URL

Follow the steps below to setup your webhook url in the API dashboard:

  • Login to app
  • Navigate to My account -> Rest API to open the API dashboard
  • Add your webhook url. Make sure the webhook URL is a public URL.

Webhook Payload

If the post has reached a completed or error state, a webhook will be sent with the payload containing the following parameters:

completed state payload

"status": "completed",
"caption": "...",
"post_id": "...",
"generated_media": [{"url": "..."}],
"brand_id": "..."

error state payload

"status": "error",
"post_id": "..."

We will send the webhook exactly once for each post even if we receive a non-successful response from your servers. In case your servers fail to handle the webhook event, you can get the data of all your generated posts. Read more about it here

Testing on Local Environment

It is not possible to use localhost directly to receive webhook states as the webhook URL must be a public URL. You can handle this by creating a tunnel to your local server using tools such as ngrok. Use the URL endpoint generated by these tools in the webhook URL while setting up your webhook URL in the dashboard.

Additional Resources