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>





{
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");
}
No comments:
Post a Comment