Sending a campaign via the API
If your layout comes from another system, such as a CMS that already generates the newsletter, you can create, populate and send the campaign entirely via the API. There is no need to open the editor.
Create the campaign
The sender address must be approved within Laposta, otherwise you will receive an error message. Under list_ids, specify the lists and any segments that should receive the campaign.
Populate the campaign with HTML
Include the HTML in the request, or provide a URL where Laposta can fetch the code. Choose one of the two. If you provide both, Laposta will use the HTML included in the request.
The response includes a report with details: a missing unsubscribe link, JavaScript that has been stripped out, or an image that could not be loaded. You can still send the campaign with these comments, but be sure to check them first.
Sending cannot be undone. A second call is not blocked and will trigger the delivery again. Make sure your own code prevents this: record that you have already sent a campaign, and do not allow the same action to be triggered twice by a repeated call or a double click. You can cancel a scheduled campaign by deleting it.
A campaign created in the drag & drop editor cannot be populated or read via the API. Doing so will return the message “Wrong campaign type”. Managing content via the API only works for campaigns that you have created or imported yourself.
Retrieving results after sending
You can request the results immediately after sending. The figures will continue to rise as more recipients open the email and click on links.