Email Sending API

Email Sending integration API (webhook)

Terminology

  1. ec: End customer
  2. pjh: Personal Journey Hub

 

API

Roojoom will send a JSON that will contain an array of messages to send to the End customers and a dictionary of email templates. The email templates will be referenced from within each message by the ‘email_template_id’ property.

 

Request

Method: post

Body:

{

"messages": [

{

"ec_roojoom_id": "[EC_ROOJOOM_ID]",

"email_template_id": “[EMAIL_TEMPLATE_ID]”,

"delivery_id": “[DELIVERY_ID]”,

“pjh_link”: “[PJH_LINK]”,

},

...

],

"email_templates":

{

"1": {

"body": "[HTML_TEMPLATE]",

"subject": "[SUBJECT_TEMPLATE]"

},...

}

 

(see example for reference)

Response

Success

Status_code: 200

Body:

{

  “status”: “success”

}

Failure

In case of an error in one or more messages, the API will return error response, with "failed" status and array of message_error objects.

Status_code: 400

Body:

{

  “status”: “failed”,

  “errors”: [

    {

      "ec_roojoom_id" : [EC_ROOJOOM_ID],

      "error": [ERROR_MESSAGE]

    },

    ...

  ]

}

 

Objects

Message Object (JSON)

  1. ec_roojoom_id - Encrypted customer ID with an encryption key that only client has.
  2. email_template_id - reference to email template object.
  3. delivery_id - For audit purposes
  4. pjh_link  - this link is personalized to the specific end customer, however it is missing the name of the customer - need to add the name parameter according to the spec of Roojoom URL personalization

 

Email Template Object (JSON)

The templates will include the subject and the body of the email, and will have to be processed before the sending.

  1. body - the email body (HTML). This body will contain placeholders to be filled by the client.
  2. subject - the email subject, which may contain placeholder for the name of the customer.

Message Error Object (JSON)

  1. ec_roojoom_id - Encrypted customer ID with an encryption key that only client has.
  2. error -  The error message of this specific end customer.

 

Parameters that the client needs to replace in the template

  1. Roojoom Parameters (from the message object):
    1. PJH_LINK - {{ pjh_link }}
  2. Client Parameters:
    1. Name in subject - {{ name }}
    2. Name in Email body - {{ name }}
    3. Name encoded in the PJH link - {{ pjh_ped }}
    4. Customer ID in the unsubscribe link {{ unsubscribe_customer_id }}

Example

{

"messages": [

{

"ec_roojoom_id": "fd6462fb-a78b-4edb-b1a1-fc6d9b81837e",

"email_template_id": "1",

"delivery_id": "55dbd117-6b69-468a-b79e-289282b8c977",

"pjh_link": "https://tracks.roojoom.com/cp/7f9a5992-6c80-49b2-9115-53b1d37b24dc,1,d282e7fd-542d-4132-9a2c-911e4469b2e5"

},

{

"ec_roojoom_id": "2519bdfc-6596-4b60-bcf4-89360d9bd38c",

"email_template_id": "1",

"delivery_id": "f7434854-996f-4cf0-9039-c0e9a3e04c71",

"pjh_link": "https://tracks.roojoom.com/cp/7f9a5992-6c80-49b2-9115-53b1d37b24dc,2,f1a58b45-2bed-4509-965f-21ff716c12c2"

}

],

"email_templates": {

"1": {

"subject": "Hello {{name}}",

"body": "<html><body><h1>Hello {{name}}</h1><a href='{{pjh_link}}?ped={{pjh_ped}}'>Start Here</a><span><a href='https://company.com/unsubscribe/{{unsubscribe_customer_id}}'>Unsubscribe</a></span></body></html>"

}

}

}

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.