Step 1: Submitting recipients

Formatting of recipients array

Recipients should be submitted as an array of objects. One recipient can be added by using a single object array.

The required fields for a recipient varies by country. If any required fields are not filled out, this will be reflected in the the response object.

[ { "address line 1": "Flat 1", "address line 2": "123 Broom Road", "address line 3": "Bathwick hill", "city": "London", "country": "United Kingdom", "department": "HR" "first name": "Tim", "last name": "Johnson", "state/region": "London", "title": "Mr", "zip/postal code": "TW11 9PG" }, { "address line 1": "Flat 2", "address line 2": "456 Broom Road", "address line 3": "Bathwick hill", "city": "London", "country": "United Kingdom", "department": "HR", "first name": "John", "last name": "Doe", "state/region": "London", "title": "Mr", "zip/postal code": "TW11 9PG" } ]

Adding before the campaign

Recipients can be added before or after campaign submission.

Adding recipients before can be useful when submitting a one off campaign with one recipient whose address is already known. For example, if a customer is writing a note as a gift note to go with their order.

Here, the recipients are added within the widget itself at run time and will be added automatically when the campaign is created as part of Step 2 below.

scribelessSetRecipients(recipientsArray)

recipientsArray is an array of recipient objects as shown in the 'Formatting of recipients array' section above.

Adding after the campaign

Alternatively, adding recipients afterwards can be useful if a campaign has been created and is to be reused on several occasions. For example, if a customer of yours wants to send a note with a variable several times.

For this, the campaign id that is returned in Step 2 below, will need to be used to specify which campaign the recipient is being added to. This camaign id may be stored and used later for this.

The following function needs to be called:

scribelessSetRecipientsAPI(campaignId, recipientsArray)

recipientsArray is an array of recipient objects as shown in the 'Formatting of recipients array' section above.

campaignId is the id of the campaign received at the time of campaign creation using the scribelessCreateCampaign() function.

Response

Calling this function gives an asynchronous response to confirm that the specified recipients have been added. For example, the below.

{ "success":true, "cost":0, "status":"Pending", "id":"Dti6o7ULnhzUNaNhlyA5", "currency":"gbp", "recipient_ids":["v98VLZJ3SAYm81HjfzkW"], "preview_url":"<https://prod-interface-storage.scribeless.co/campaigns/Dti6o7ULnhzUNaNhlyA5/recipient/v98VLZJ3SAYm81HjfzkW/thumbnail-front.png?t=8929003189>", "url":"<https://app.scribeless.co/campaign/Dti6o7ULnhzUNaNhlyA5>", "stationary_thumbnail":"<https://prod-interface-storage.scribeless.co/stationary/XEwk0ou4ZQSyHBXSEsEz/thumbnail.png?t=1314008617>" }

Step 2: Submitting a campaign

When a user has finished producing their campaign, their campaign needs to be created on the Scribeless platform. This can be done by simply calling the below function.

The campaign will be assigned to the account corresponding to the API key.

scribelessCreateCampaign()

Response

Calling this function gives an asynchronous response to confirm that the campaign have been successfully submitted. For example, the below.

{ "success":true, "cost":344, "status":"Pending", "id":"y97p0KMZoVFGAgGibHkd", "currency":"gbp", "recipient_ids":["mvG9zHvj1FAi5syigHgv"], "preview_url":"<https://dev-storage.scribeless.co/campaigns/y97p0KMZoVFGAgGibHkd/recipient/mvG9zHvj1FAi5syigHgv/thumbnail-front.png?t=8929003189","url":"https://hc-application-interface-dev.firebaseapp.com/campaign/y97p0KMZoVFGAgGibHkd>", "stationary_thumbnail":null }
Did this answer your question?