Skip to content

Send email

Sends a transactional email

Endpoint URI

1
POST https://services.ownpage.fr/v1/transactional/send

Headers

  • X-Ownpage-Client-Token : a valid token

Payload (JSON)

The data should be a JSON object containing the following parameters :

  • subject (string) : (mandatory) Subject of the message
  • sender (EmailObject) : (mandatory) Sender from which the email will be sent
  • to (array of EmailObject) : (mandatory) List of the recipients
  • cc (array of EmailObject) : List of the recipients in cc
  • bcc (array of EmailObject) : List of the recipients in bcc
  • replyTo (EmailObject) : Email address on which recipients will be able to reply
  • headers (object) : Set of custom headers sent in email
  • attachment (array of AttachmentObject) : List of attachments of the message
  • htmlContent (string) : (ignored if templateId is passed) HTML body of the message
  • textContent (string) : (ignored if templateId is passed) Plain Text body of the message
  • templateId (integer) : ID of the template to use for the body of the message
  • params (object) : Set of attributes to customize the template
    • NOTE : values are interpreted as HTML code, so it should be HTML-encoded to be interpreted as plain text
  • tags (array of strings) : List of tags to apply on the transactional email

EmailObject

Objects of type EmailObject should contain the following parameters:

  • email (string) : (mandatory) Email address of the contact
  • name (string) : Name of the contact

AttachmentObject

Objects of type AttachmentObject should contain the following parameters:

  • name (string) : (mandatory) Name of the attachment file
  • content (string) : (ignored if url is passed) Content of the attachment file encoded in base64
  • url (string) : URL of the attachment file

Response (JSON)

The response is an object with the following fields :

  • messageId : ID of the transactional email sent

NOTE : Once sent, a preview of the email will be available for 60 days at the URL https://mirror.ownpage.fr/clients/CLIENT_KEY/transactional/MESSAGE_ID.html

Example

1
curl -X POST --header "X-Ownpage-Client-Token:TOKEN" --header "Content-Type:application/json" --data REQUEST_DATA https://services.ownpage.fr/v1/transactional/send

With REQUEST_DATA:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
    "sender": {
        "email": "test@opper.io",
        "name": "opper MarketingSuite"
    },
    "to": [
        { 
            "email": "email@domain.com"
        }
    ],
    "subject": "Subject",
    "templateId": 1,
    "params": {
        "VARIABLE_1": "value 1",
        "VARIABLE_2": "value 2"
    },
    "tags": ["Test"]
}

Response example:

1
2
3
{
    "messageId": "67e42a12d3071b0001f6dfcc"
}

Comments