Tuesday, 20 September 2016

SilverPOP Integration ASP.NET - Add a Contact to a Contact list

Add a Contact to a Contact list

AddContactToContactList API is used to add new contact to contact list. There are various elements used along with this API as follows:

CONTACT_LIST_ID : The ID of the Contact List to which you are adding the contact. CONTACT_ID : The ID of the contact being added to the Contact List.

COLUMN : Required if the database has a key other than Email or no Unique Identifier and Contact 

Id is not provided.

///  <summary>
///  AddContactToContactList API is used to add new contact to contact list.
///  </summary>
///  <param name="sessionId">Session id.</param>

///  <param name="contactListId">Contact list id.</param>
///  <param name="contactId">Contact id.</param>

///  <param name="columnName">Column name.</param>

///  <param name="columnValue">Column value.</param>

///  <returns>AddContactToContactList status.</returns>
private bool AddContactToContactList(string sessionId, long contactListId, long contactId, string columnName, string columnValue)
{

EngageSoapApiClientService_InterfaceClient engage = new EngageSoapApiClientService_InterfaceClient();

AddContactToContactListRequestType addContactToContactList = new AddContactToContactListRequestType();

sessionheadertype sessionHeader = new sessionheadertype(); sessionHeader.sessionid = sessionId; ListMgmtUserActionsResponseType listMgmtUserActionsResponse = new

ListMgmtUserActionsResponseType();


addContactToContactList.CONTACT_LIST_ID = contactListId; addContactToContactList.CONTACT_ID = contactId; addContactToContactList.COLUMN = new ColumnNameValueElementType[]
{

new ColumnNameValueElementType() { NAME = columnName,
VALUE = columnValue }
};

listMgmtUserActionsResponse = engage.AddContactToContactList(sessionHeader, addContactToContactList);

return listMgmtUserActionsResponse.SUCCESS;


}

SilverPOP Integration ASP.NET - Add a Column to a silverpop database

Add a Column to a database

AddListColumn API is used to add new column to an existing database.

There are various elements used along with this API as follows:

LIST_ID : The ID of the Engage database the column is being added to.

COLUMN_NAME : The name of the column being added.

COLUMN_TYPE : Defines what type of column to create. The following is a list of valid values :

0 – Text column
1 – YES/No column

2 – Numeric column
3 – Date column
4 – Time column


5 – Country column
6 – Select one

8 – Segmenting
13 – SMS Opt In

14 – SMS Opted Out Date
15 – SMS Phone Number
16 – Phone Number

17 – Timestamp
20 – Multi-Select

///  <summary>
///  AddListColumn API is used to add new column to an existing database.
///  </summary>
///  <param name="sessionId">Session id.</param>

///  <param name="listId">List id.</param>

///  <param name="columnName">Column name.</param>
///  <returns>AddListColumn status.</returns>
private bool AddListColumn(string sessionId, long listId, string columnName)
{

EngageSoapApiClientService_InterfaceClient engage = new 
EngageSoapApiClientService_InterfaceClient();

AddListColumnRequestType addListColumnRequest = new AddListColumnRequestType(); sessionheadertype sessionHeader = new sessionheadertype(); sessionHeader.sessionid = sessionId;

ListMgmtUserActionsResponseType listMgmtUserActionResponse = new ListMgmtUserActionsResponseType();

addListColumnRequest.LIST_ID = listId; addListColumnRequest.COLUMN_NAME = columnName; addListColumnRequest.COLUMN_TYPE = 0;

listMgmtUserActionResponse = engage.AddListColumn(sessionHeader, addListColumnRequest); return listMgmtUserActionResponse.SUCCESS;


}

SilverPOP Integration ASP.NET- Add Contact to silverpop database

Add a Contact

As the name is self explainatory, this interface used to add new contact to an existing database.

For adding the recipient we need to provide the ID of of the database to which we are adding a contact 

along with the values of the fileds which uniquely identifies the row in that database.

There are various elements used along with this API as follows:

LIST_ID : The ID of the database to which you are adding the contact.

CREATED_FROM : Value indicating the way in which you are adding the contact to the system. Values 

include:

0 – Imported from a database

1 – Added manually
2 – Opted in

3 – Created from tracking database



UPDATE_IF_FOUND : If the UPDATE_IF_FOUND element is set to true, attempting to add a contact with a

COLUMN : XML nodes defining the column name and value for fields being added or updated.

SEND_AUTOREPLY : If the database has an autoresponder associated with it and the 

SEND_AUTOREPLY element is set to true, Engage sends the confirmation when the contact is added 

to the database.

///  <summary>
///  AddRecipient API is used to add new contact to an existing database.
///  </summary>
///  <param name="sessionId">Session id.</param>
///  <param name="listId">List id.</param>

///  <returns>Recipient id.</returns>
private string AddRecipient(string sessionId, long listId)
{

EngageSoapApiClientService_InterfaceClient engage = new EngageSoapApiClientService_InterfaceClient();

AddRecipientRequestType addRecipientRequest = new AddRecipientRequestType(); sessionheadertype sessionHeader = new sessionheadertype(); sessionHeader.sessionid = sessionId;

ListMgmtResponseType listMgmtResponse = new ListMgmtResponseType(); addRecipientRequest.LIST_ID = listId; addRecipientRequest.CREATED_FROM = 2; addRecipientRequest.UPDATE_IF_FOUND = true; addRecipientRequest.COLUMN = new ColumnElementType[]

{

new ColumnElementType { NAME = "UserID", VALUE = "101" }, new ColumnElementType { NAME = "UserName", VALUE = "abc" }

}; addRecipientRequest.SEND_AUTOREPLY = true;

listMgmtResponse = engage.AddRecipient(sessionHeader, addRecipientRequest); if (listMgmtResponse.SUCCESS)

return listMgmtResponse.RecipientId; else

throw new Exception("Unable to add recipient");


}