Compliance & Consent

Record a consent event

Records that a person granted or withdrew consent, with the evidence you hold (the wording shown, the page URL, the IP, a reference). recorded_at may be backdated for an imported consent; it cannot be in the future. A marketing withdrawal is also placed on the opt-out list immediately.

source is limited to api, form, import and dashboard: the keyword and inbound sources are the platform's own observations and are reserved.

post/consents

Request

  • Base URL: https://api.envoisms.ma/v1
  • URL: https://api.envoisms.ma/v1/consents
  • Auth: HTTP bearer

Request body

phonestring required
purpose'marketing' | 'transactional' | 'otp' | 'service' required
status'granted' | 'withdrawn'
channel'whatsapp' | 'sms' | 'any'
source'api' | 'form' | 'import' | 'dashboard'
evidenceobject

Free-form JSON object under 4 KB — the wording shown, url, ip, reference

recorded_atstring date-time

When the person acted (defaults to now; may be backdated, never in the future)

Example request

{
  "phone": "+212612345678",
  "evidence": {
    "text": "J'accepte de recevoir les offres par WhatsApp",
    "url": "https://example.ma/inscription",
    "ip": "41.140.0.1"
  }
}

Response

Event recorded

idstring
phonestring
channel'whatsapp' | 'sms' | 'any'
purpose'marketing' | 'transactional' | 'otp' | 'service'
status'granted' | 'withdrawn'
source'api' | 'form' | 'import' | 'dashboard' | 'whatsapp_keyword' | 'sms_keyword' | 'whatsapp_inbound' | 'ctwa'
evidenceobject nullable
recorded_atstring date-time
created_atstring date-time

Example response

{
  "id": "cns_9f2a...",
  "phone": "+212612345678"
}

Changes

No recorded changes to this operation across all 1 revision of this API.