CFD design for Predictive Dialer with Rest API option to download csv file

Status
Not open for further replies.

ybello

Platinum Partner
Advanced Certified
Joined
May 18, 2019
Messages
49
Reaction score
25
I am trying to initiate outbound calls from a JSON response gotten from an endpoint.

I have split the process into two flows as follows:

1. The first flow calls the Webservice which returns a json response. The flow has a C# component that writes a .csv file to the system. The C# code used is shown below (i am using the output from the webservice as input parameter (jsonInput):
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
public class Program
{
public string Main(string jsonInput)
{
// Parse JSON array
List<string> numbers = JsonConvert.DeserializeObject<List<string>>(jsonInput);
// Generate unique CSV file path with date and time
string dateTimeString = DateTime.Now.ToString("yyyyMMdd_HHmmss");
string csvFilePath = $"numbers_{dateTimeString}.csv";
// Write to CSV file
WriteToCsv(numbers, csvFilePath);
// Return the CSV file path
return csvFilePath;
}
private void WriteToCsv(List<string> data, string filePath)
{
// Write data to CSV file
using (StreamWriter writer = new StreamWriter(filePath))
{
foreach (string item in data)
{
writer.WriteLine(item);
}
}
}
}
1715343367672.png
2. A 2nd flow will read the .csv file and proceed with the Autodialer as normal.

The issue is with the first flow as it fails when i compile and upload to 3CX with multiple syntax errors.

Will appreciate a second look at this from anyone please.

Thank you.
 
Just use one flow that takes the data directly? Why write a CSV? You can use the JSON response and parse it.
 
Hello @ybello,

If you want a simpler solution, you can try SIP Caller, a cloud based outbound call dialer which seamlessly integrates with 3CX, and you can have working in 5 minutes. With SIP Caller you will get out of the box detailed call reports, summarized call reports, answering machine detection, and much more.

You can give it a try for free, contact me if you need additional information.
 
  • Like
Reactions: OlegR_3CX
Just use one flow that takes the data directly? Why write a CSV? You can use the JSON response and parse it.
Can you share more light please? How do I reiterate through all the numbers?
 
Use a loop and a C# script to grab the entry from the Json. Use Newtonsoft.Json to deserialize the data in that same script.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,893
Messages
589,598
Members
164,763
Latest member
Techmansam