This is a .NET client of zamanak ( web service
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Zamanak .NET Web service client

In order to use zamanak api, you should have username and password so feel free go to and register. some zamanak apis need uid and token to work properly so you need to first call general/authenticate method to receive uid and token, remember that token is valid for one year.

Create a Zamanak Client Object

using Zamanak.WebService.V5;
using Zamanak.WebService.V5.Request;
using Zamanak.WebService.V5.Response;
// If you havn`t yet received YOUR_ZAMANAK_UID and YOUR_ZAMANAK_TOKEN leave them ""
ZamanakClient client = new ZamanakClient(config);

Sending auto generated random numeric captcha

var req = new General_CaptchaRequest("0912*******");
var res =  client.General.Captcha(req);

Sending a number to specified mobile

Note: number will be read for person

var req = new General_NumberReaderRequest("0912*******", "Your desire number to be read for user for example 1234");
var res = client.General.NumberReader(req);

Send your favorite number by sms

(maximum 8 characters)

var req = new General_SendCaptchaSmsRequest("0912*******", 1234);
var res = client.General.SendCaptchaSms(req);

Calculate how long converted text in seconds

var req = new General_TextToVoiceCalculatorRequest("YOUR TEXT");
var res = client.General.TextToVoiceCalculator(req);
Console.WriteLine("LengthInSeconds=" + res.LengthInSeconds);

Convert your text to base64 encoded wav file

Note: you should decode the result then write in wav file

var req = new General_Text2CodeRequest("YOUR TEXT");
var res = client.General.Text2Code(req);
Console.WriteLine("Content=" + res.Content);

Create new campaign by text

Note: Empty startTime means now . repeat number shoud be greater than zero : >=1

var numbers = new List<string>();

var req = new Campaign_NewCampaignByTextRequest("CAMPAIGN NAME", numbers, "TEXT", "START_TIME", "STOP_TIME", "REPEAT_TOTAL");
var res = client.Campaign.NewCampaignByText(req);

Create new campaign by numbers

Note: Empty startTime means now . repeat number shoud be greater than zero : >=1

var numbers = new List<string>();
long recordingId = 0; //recordingId of uploaded sound

var req = new Campaign_NewCampaignByNumbersRequest("CAMPAIGN NAME", numbers, recordingId, "START_TIME", "STOP_TIME", "REPEAT_TOTAL");
var res = client.Campaign.NewCampaignByNumbers(req);

Create new mix campaign

Note: This method create new mix campaign,machine first reading your recording audio then read number,$recording array contain your recording id,$numbers contain your numbers which you want to say,notice that each element of array is for one contact so sepreate numbers of each element by ','.$sayMethod means that how do you like to say your numbers?for example if your number is 3139687 and sayMethod is 322 means machine reads 313 96 87,$mixType is default 'number'

var campaignName = "test campaign name";
long contact_count = 2;
long recording_count = 2;
long numbers_count = 2;

var to = new List<string>();

var recordings = new List<string>();

var numbers = new List<string>();

string sayMethod = "322";
string mixType = "number";
long retry = 1; //retry count

var req = new Campaign_NewMixCampaignRequest(campaignName, contact_count, recording_count, numbers_count, to, recordings, numbers, sayMethod, mixType, retry);
var res = client.Campaign.NewMixCampaign(req);
Console.WriteLine("CampId=" + res.CampId);

Get campaign status

var req = new CampaignReport_GetCampaignStatusRequest("CAMP_ID");
var res = client.CampaignReport.GetCampaignStatus(req);
//process res

Get campaign logs

Note: Items per page is 10

var req = new CampaignReport_GetCampaignLogsRequest("CAMP_ID", "PAGE_NUMBER");
var res = client.CampaignReport.GetCampaignLogs(req);
//process res

Get campaign logs extended

Note: Items per page is 100

var req = new CampaignReport_GetCampaignLogsExtendedRequest("CAMP_ID", "PAGE_NUMBER");
var res = client.CampaignReport.GetCampaignLogsExtended(req);
//process res

Get live number status

var campId = "CAMP_ID";
var phone = "0912*******";
var req = new CampaignReport_LiveNumberStatusRequest(campId, phone);
var res = client.CampaingReport.LiveNumberStatus(req);
//process res (res.PhoneNumber,res.StartStamp,res.CampId,res.Status,res.Digit)