13
Swift Digital Subscription API Documentation 2020 For queries please contact [email protected] 2020 Swift Digital. All Rights Reserved Swift Digital Subscription API Exported on 09/12/2018 Table of Contents 1 Step-by-step guide................................................................................................... 3

  Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

  • Upload
    others

  • View
    19

  • Download
    0

Embed Size (px)

Citation preview

Page 1:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

Swift Digital Subscription API Documentation 2020 For queries please contact [email protected] 2020 Swift Digital. All Rights Reserved

Swift Digital Subscription API

Exported on 09/12/2018

Table of Contents

1 Step-by-step guide................................................................................................... 3

Page 2:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

2

1Step-by-step guide

Getting Started

What is Swift Digital API?

Where will it be used?

How will it beneficial?

Who is it for?

Page 3:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 3

Code Snippet

<script src=" https://code.jquery.com/jquery-1.11.3.min.js"></script>

<script type="text/javascript">

function subscribeUser()

{

frm = document.subscribe;

var st = {};

st.EMAIL = frm.elements['st[EMAIL]'].value; // it stores the email id

var cu = {};

var gr = ['zzzz5b7d06123abcde48']; // One or more mail group IDs

separated by commas // For more details please check to Step: 6

// Note: st, cu, gr are objects where

you can store data for

API.

var my_micro_site = "http://micro site name here"; // For more details please

check to Step: 7

$.getJSON(my_micro_site + "/scripts/subscribe/subscribe.php?callback=?",

{

st: st,

cu: cu,

gr: gr, // st, cu, gr are query params for

passing the data to the server.

method: "skip", // Using method skip

format: "json"

}, function(data) { // You will get the JSON response

here.

console.log('response from server');

console.log(data) // By the help of console.log() you

can see the response.

});

}

</script>

<button onclick="subscribeUser()">Test</button>

Page 4:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 4

Code Flow

Step 1: Load jQuery Standard jQuery loading process. Use 1.5+.

Step 2: Create a method that will capture subscriber action < script type="text/javascript" > function subscribeUser () { ... } < /script >

Step 3: var st = {}; Here var st is an object where you can add anything like st. NA ME this will store into var sr .

Step 4: st.EMAIL = frm.elements['st[EMAIL]'].value; Here in st.EMAIL you can assign your email address like this you can also assign other fields. Now you have selected 5 fields first_name, last_name, email, mobile, country. for example : st.FIRST_NAME = ”Enter First Name”; st.LAST_NAME = “Enter Last Name”; st.EMAIL = “Enter Email”; st.MOBILE = “Enter Mobile”; st.COUNTRY = ”Country”;

As you can see For Example: > Go to Choose a Module Tab click on Mail House After login you will get this page after than please choose a Module name Mail House.

Page 5:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 5

> After than click on Custom Fields you can find all the fields.

Step 5: var cu = {}; this is an object where you can save values.

Page 6:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 6

Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345', ‘zzzz12245673554322’]; gr is an object where you can put one or more than one mail group Id separated by commas. NOTE: st, cu, gr where you can store data for API.

As you can see the example given below you can get the gr Id Please go through this link > Go to Mail House click on any Mail Group after that you can get the gr id on the url.

After than choose the Current Folder name SDA flow . Here you can create more than one mail group .

Click on SDA flow and then you will get gr Id in the url.

Page 7:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 7

Step 7: var my_micro_site = " http://micro site name here"; In my_micro_site you have to assign Publication URL . You will get the publication url from Administration Menu -> Account Settings -> Publication URL . For Example: After login you will get like this > Go to Choose a Module Tab click on Administration

> Click on Account Settings

Page 8:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 8

> Then you will get the publication url

Step 8: The getJSON function will send the request to the Swift Digital Suite. You can process the Suite's response in the callback function. $.getJSON(my_micro_site + "/scripts/subscribe/subscribe.php?callback=?", { ... } Here my_micro_site is your base url . /scripts/subscribe/ is my sub parameter of API. subscribe.php?callback=? this is your query params

Page 9:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 9

Method Description

Method

Description

skip This is the default behaviour. If API call doesn't provide any value for 'method',

suite will automatically set this value.

If method is set to 'skip' and email address already exists in Mail House than

suite will take no action and ignore the request.

createne If method is set to 'createnew' than suite will create a new record

(even if the email w address already in Mail House).

(Not Recommended at this point of time)

updateal If method is set to 'updateall' and email address already exists in Mail

House than suite will l update contact's data (first name, last name, title etc.) and

subscription (groups data).

updategr If method is set to 'updategroups' and email address already exists in Mail

House than oups suite will only update subscriptions (groups data).

It will change the format into JSON. When the response will come it will look like this :

Step 9: st: st, cu: cu, gr: gr, Here st, cu, gr are query params for passing the data to the server.

Step 10: method: "skip", using method skip.

Step 11: Format is Json format: "json"

Step 12: function( data ){ .. } You got the success data into this data. By the help of console.log () you can check what's the output coming in your data. console.log(data)

Page 10:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 10

updatefi If method is set to 'updatefields' and email address already exists in Mail House than suite elds will only update contact's data (first name, last name, title etc.).

Response Codes and Messages

Code Message

000 Thank you for subscribing to our newsletter.

101 Please enter your details to sign up for this e-newsletter.

102 You have been previously unsubscribed from this e-newsletter. Please use the update details feature to resubscribe.

103 You are already subscribed to this e-newsletter.

104 That doesn't appear to be a valid email.

105 Unable to subscribe. Please check your details and try again.

106 Invalid attempt.

Page 11:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 11

Appendix This will require an additional parameter notify_subscription . You will need to provide the email address that will receive the notification.

Additional Parameters

< script src=" https://code.jquery.com/jquery-1.11.3.min.js"></script > < script type="text/javascript" > function subscribeUser(){ var st = {}; st.EMAIL = " test@gmail .co m 1 "; var cu = {}; var gr = ['zzzz123456789012345']; // One or more mail group IDs separated by commas var my_micro_site = " http://internal.staging.swiftdigital.com.a u "; $.getJSON(my_micro_site + "/scripts/subscribe/subscribe.php?callback=?", { st: st, cu: cu, gr: gr, notify_subscription "notify@gmail : .co m 2 ", method: 'skip', format: "json" },function(data) { console.log('response from server'); console.log(data) }); }

> /script < button onclick="subscribeUser()">Test</button < >

How to get a double opt in email when user subscribe using this API?

Parameter Description

double_opt _in

Set it to true if you want to use double-opt-in

double_opt _in_subject

This is an optional parameter. Default value is “Please verify your email address to subscribe”. However you can customize it as per your need.

return_url The url that will be loaded once user confirm the subscription. It can be an LP page URL or any Web URL.

Page 12:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 12

1 http://rootinfosol.com/

2 http://rootinfosol.com

You will need to provide these parameters that will receive the double-opt-in email.

< script src=" https://code.jquery.com/jquery-1.11.3.min.js"></script > < script type="text/javascript" > function subscribeUser(){ frm = document.subscribe; var st = {}; st.FIRST_NAME = frm.elements['st[FIRST_NAME]'].value; st.LAST_NAME = frm.elements['st[LAST_NAME]'].value; st.EMAIL = frm.elements['st[EMAIL]'].value; var cu = {}; //cu.cu_5796_TEST_1 = frm.elements['cu[5796_TEST_1]'].value;

var gr = ['zzzz51099b7689844611']; $.getJSON(" http://internal.staging.swiftdigital.com.au/scripts/subscribe/subscribe.php ?

= callback ?", { st: st, cu: cu, gr: gr, method: 'updateall', format: "json", double_opt_in: true, double_opt_in_subject: "Click to confirm your subscription", return_url: " http://internal.staging.swiftdigital.com.au/subscriptionconfirmatio n " }, function(data) { console.log(data); }); }

/script < >

How To Run on Postman?

Step 1: Open Postman enter request URL http://internal.staging.swiftdigital.com.au/scripts/subscribe/subscribe.ph p ?

then click on Params enter key and values after than click on Send button like given example.

Page 13:   Swift Digital Subscription API...SD API – Swift Digital Subscription API Step-by-step guide – 6 Step 6: var gr = ['zzzz123456789012345']; OR, var gr = ['zzzz123456789012345',

SD API – Swift Digital Subscription API

Step-by-step guide – 13

Related articles

Swift Digital Subscription API (see page 0)

After than you will get the result