Skip to content

ffl_core.api.marketing

Source: apps/ffl_core/ffl_core/api/marketing.py · 9 endpoint(s)

Generated by make api-docs — do not edit by hand.

close_request

POST /api/method/ffl_core.api.marketing.close_request

Auth (derived from code): Roles: Marketing User / Sales Manager / System Manager

Stop waiting on a reminder request: an Open request becomes Closed and is never notified.

Refused while marketing is switched off.

arg type required default description
request string yes — The Marketing Request.

Returns: {"request": its name, "status": the status now, "changed": False when it was already Notified or Closed}.

apps/ffl_core/ffl_core/api/marketing.py:289

contact_card

GET /api/method/ffl_core.api.marketing.contact_card

Auth (derived from code): Requires read permission on Marketing Contact (Frappe DocType permission check).

One marketing contact: its record, tags, latest events and the reminders still waiting.

Refused while marketing is switched off.

arg type required default description
contact string yes — The Marketing Contact (its email address).
events integer no 20 How many of the latest events to return (at most 200).

Returns: {"contact": {email, first_name, last_name, status, source, consent_at, consent_channel, status_changed_at, status_reason, customer, creation, tags, suppressed}, "events": [{kind, occurred_at, mail, campaign, detail}] newest first, "open_requests": the Open reminder requests}.

apps/ffl_core/ffl_core/api/marketing.py:172

customer_card

POST /api/method/ffl_core.api.marketing.customer_card

Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).

The line the Customer form shows about a customer's marketing email.

Nothing (None) when marketing is off, the user may not read Marketing Contacts or the customer, or no marketing contact is linked to the customer.

arg type required default description
customer string yes — The Customer's name.

Returns: {"status": the contact's status, "tags": its tags, "text": the line to show, "contact": the Marketing Contact (its email address) to open}, or None.

apps/ffl_core/ffl_core/api/marketing.py:79

find_contacts

GET /api/method/ffl_core.api.marketing.find_contacts

Auth (derived from code): Requires read permission on Marketing Contact (Frappe DocType permission check).

Find marketing contacts, newest first.

Any of the filters, together. Refused while marketing is switched off.

arg type required default description
email string | null no None Part of the email address.
name string | null no None Part of the first or last name.
tag string | null no None A tag the contact has (exact).
status string | null no None Not Subscribed, Subscribed, Unsubscribed, Bounced or Complained.
source string | null no None Where the contact first came from; a prefix ("fluentform" matches "fluentform:3").
limit integer no 20 How many to return (at most 200).
start integer no 0 How many to skip, for the next page.

Returns: {"total": how many contacts match, "contacts": [{email, first_name, last_name, status, source, consent_at, consent_channel, status_changed_at, status_reason, customer, creation, tags}]}.

apps/ffl_core/ffl_core/api/marketing.py:122

list_requests

GET /api/method/ffl_core.api.marketing.list_requests

Auth (derived from code): Requires read permission on Marketing Request (Frappe DocType permission check).

Back-in-stock and model-alert reminder requests, newest first.

Refused while marketing is switched off.

arg type required default description
status string | null no 'Open' Open (the default), Notified or Closed; "all" for every status.
kind string | null no None Back in stock or Model alert.
contact string | null no None One contact's (its email address).
item string | null no None The POS Item the request is for.
limit integer no 50 How many to return (at most 200).
start integer no 0 How many to skip, for the next page.

Returns: [{name, contact, kind, status, label, item, sku, web_product_id, model_key, url, requested_at, notified_at}].

apps/ffl_core/ffl_core/api/marketing.py:259

POST /api/method/ffl_core.api.marketing.record_consent

Auth (derived from code): Roles: Marketing User / Sales Manager / System Manager

Record that a contact agreed to marketing email: Not Subscribed becomes Subscribed.

For a consent given outside the website (at the counter, on the phone, on a paper form). A contact that unsubscribed, bounced or complained is refused: this never puts one back (a manager can, on the contact's form, with a reason). Who recorded it, the channel and the note go on the log. Refused while marketing is switched off.

arg type required default description
contact string yes — The Marketing Contact (its email address).
channel string yes — Where the consent was given, in a word or two ("in store", "phone").
note string | null no None Anything worth keeping with it. Optional.

Returns: {"contact": the address, "status": the status now, "changed": False when it was already Subscribed}.

apps/ffl_core/ffl_core/api/marketing.py:226

resubscribe

POST /api/method/ffl_core.api.marketing.resubscribe

Auth (derived from code): Roles: Sales Manager / System Manager

Put a suppressed contact back to Subscribed.

For a contact that unsubscribed, bounced or complained. The reason is required and goes on the log with who did it.

arg type required default description
contact string yes — The Marketing Contact (its email address).
reason string yes — Why this contact may be emailed again.

Returns: {"contact": the address, "status": "Subscribed"}. Refused for a contact that is not suppressed.

apps/ffl_core/ffl_core/api/marketing.py:57

tag_contact

POST /api/method/ffl_core.api.marketing.tag_contact

Auth (derived from code): Roles: Marketing User / Sales Manager / System Manager

Add tags to a marketing contact and take tags off it.

A tag is a slug (lowercase letters, digits and dashes); anything else is refused, nothing changed. Tags never send anything. Refused while marketing is switched off.

arg type required default description
contact string yes — The Marketing Contact (its email address).
add list str no None
remove list str no None

Returns: {"contact": the address, "added": tags that were new to it, "removed": tags it had, "tags": its tags now}.

apps/ffl_core/ffl_core/api/marketing.py:197

unsubscribe

POST /api/method/ffl_core.api.marketing.unsubscribe

Auth (derived from code): Roles: Marketing User / Sales Manager / System Manager

Stop marketing email to a contact.

Its status becomes Unsubscribed, with who did it and the reason on the log. A contact already Unsubscribed, Bounced or Complained is left as it is.

arg type required default description
contact string yes — The Marketing Contact (its email address).
reason string | null no None Why, in a few words. Optional.

Returns: {"contact": the address, "status": the status now, "changed": False when it was already suppressed}.

apps/ffl_core/ffl_core/api/marketing.py:35