Forms
`forms.list`, `get`, `create`, `update`, `delete`, `publish`, `pause`, `resume`, `duplicate`, `analytics`, `list_starters`, `get_starter`, `list_submissions`, `get_submission`, `delete_submission`, `delete_submissions`, `approve_submission`, `resend_confirmation` and `subscribe`.
Every method
from openemail import openemail form = openemail.forms.create({ 'name': 'Newsletter sign-up', 'starter': 'newsletter', 'settings': {'audienceIds': ['aud_4c1b8e2a7d9f05c36b4e8a71']}, 'publish': True,}) print(form['url'], form['subscribeUrl']) saved = openemail.forms.update(form['id'], { 'settings': {'doubleOptIn': True, 'senderAddress': '[email protected]'}, 'expectedUpdatedAt': form['updatedAt'],}) signup = openemail.forms.subscribe(form['id'], { 'email': '[email protected]', 'first_name': 'Ann', 'consent': True,}) for submission in openemail.forms.iterate_submissions(form['id'], status='pending'): if submission['expired']: openemail.forms.resend_confirmation(form['id'], submission['id']) stats = openemail.forms.analytics(form['id'], days=30)starters = openemail.forms.list_starters() openemail.forms.pause(form['id'])openemail.forms.resume(form['id'])copy = openemail.forms.duplicate(form['id'])openemail.forms.delete(copy['id']) print(saved['senderIssue'], signup['outcome'], stats['totals']['conversion'], len(starters))A form keeps a draft document and the publishedDocument visitors see. update changes the draft and the settings, and publish puts the draft live. Settings take effect at once, published or not, and expectedUpdatedAt refuses a save that would overwrite someone else’s with 409 version_conflict.
Reading needs forms:read and changing needs forms:write. approve_submission also needs contacts:write, because it adds a contact. resend_confirmation also needs emails:send, and so does a call that makes the form send mail: turning on doubleOptIn, setting senderAddress or the confirmation email, or publishing or resuming a double opt-in form. delete asks an OAuth access token for a verification code, and an API key never.
subscribe signs someone up as the form’s page does and sends no credential, even from a client that holds one. Every sign-up from one network shares a limit of 40 every ten minutes, so a server relaying sign-ups for many people reaches it quickly: add people you already know with audiences.import_contacts instead. Pass the page the form was on as oe_source, leave out oe_started, and send oe_website empty or not at all.
A 422 from subscribe is invalid_form_submission, and the error’s fields lists each answer that is missing or not valid as {'key': ..., 'error': ...}, with reasons such as required, email and option. The client is for servers. In a browser, post the answers to the form’s subscribeUrl with fetch, as a JSON body or with an Accept: application/json header, and it answers JSON from any origin. Without either it answers with a 303 redirect to the hosted page.
Response: FormDetailResource
list returns one page of FormResource, newest first, without document and settings, and list_all and iterate walk every page. get, create, update, publish, pause, resume and duplicate return a FormDetailResource, which adds document, publishedDocument, settings, audiences, senderIssue and senderProblem.
idstr- The durable handle, `frm_` followed by 24 hex characters.
statusLiteral['draft', 'live', 'paused']- `draft` until the first publish, then `live` while it takes sign-ups and `paused` while it does not. A form never goes back to `draft`.
urlstr- The hosted page of the published form, to share as a link.
subscribeUrlstr- Where a plain HTML form, or `fetch`, posts the answers.
documentFormDocument- The draft: `fields` in order, the `copy` around them and the `style`.
publishedDocumentFormDocument | None- What visitors see now. `None` until the first publish.
settingsFormSettings- Where sign-ups go and what happens after one: `audienceIds`, `doubleOptIn`, `senderAddress`, the confirmation email, `successAction`, `redirectUrl` and `notifyAddresses`.
hasUnpublishedChangesbool- `True` when the draft differs from what visitors see. Always `False` before the first publish.
senderIssueLiteral['missing', 'not_sendable', 'not_allowed'] | None- Why a double opt-in form cannot send its confirmation emails right now, or `None` when it can.
statsFormStats- `views`, `submissions`, `added`, `pending` and `lastSubmittedAt`, counted at the moment of the read.
Submissions
list_submissions pages newest first, with q to search email addresses and status for pending or added, and list_all_submissions and iterate_submissions walk every page. Each FormSubmissionResource keeps the answers as they were sent, labels included, so it still reads right after the form changes.
resend_confirmation returns the submission with confirmationSent. It is False when nothing went out: one address gets one confirmation per form every ten minutes and five a day across the workspace, and an added submission gets none. expired marks a pending sign-up whose latest link has run out.
Reference
forms.list()Full referenceforms.list_all()Full referenceforms.iterate()Full referenceforms.get()Full referenceforms.create()Full referenceforms.update()Full referenceforms.delete()Full referenceforms.publish()Full referenceforms.pause()Full referenceforms.resume()Full referenceforms.duplicate()Full referenceforms.analytics()Full referenceforms.list_starters()Full referenceforms.get_starter()Full referenceforms.list_submissions()Full referenceforms.list_all_submissions()Full referenceforms.iterate_submissions()Full referenceforms.get_submission()Full referenceforms.delete_submission()Full referenceforms.delete_submissions()Full referenceforms.approve_submission()Full referenceforms.resend_confirmation()Full referenceforms.subscribe()Full reference