Table of Contents

Send SMS

In order to send SMS, we first need to create the text SMS which we need to send, and then we will use the text message to send it to a particular contact.

Create New Text SMS

REST API for Creating new Text SMS

    POST http://ictcore.example.com/api/messages/texts

SMS Object

    name: string // required
    data: string // required - It contains the actual message 
    type: string // unicode or plain or binary
    description: string

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/messages/texts");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
      \"name\": \"name\",
      \"data\": \"Data\",
      \"type\": \"type\",
      \"description\": \"Description\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the text_id of the recently created record.

Send SMS program

Prepare given SMS for the provided account, and make it ready to be sent

REST API for Creating Send SMS Program

    POST http://ictcore.example.com/api/programs/sendsms

Program Object

    name: string
    text_id: number // text_id of SMS text for which this program is being created

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/programs/sendsms");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
      \"name\": \"name\",
      \"text_id: 1 (number ) - text_id of SMS text for which this program is being created\": \"\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the program_id of the recently created record.

Create SMS transmission

Now send the SMS to the particular contact and enter the destination detail

REST API for Creating SMS transmission

    POST http://ictcore.example.com/api/transmissions

Transmission Object

    title: string
    program_id: number
    phone: number
    origin: string
    direction: string

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/transmissions");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
      \"title\": \"title\",
      \"phone\": 1234231,
      \"program_id\": 1,
      \"origin\": \"origin\",
      \"direction\": \"direction\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the transmission_id of the recently created record.

Send SMS Transmission

Now the transmission is successfully created, now the next step is to send that transmission.

REST API for Send SMS Transmission

    POST http://ictcore.example.com/api/transmissions/transmission_id/send

Required parameters

    transmission_id: number // ID of the transmission in the form of an integer

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/transmissions/transmission_id/send");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Now the SMS will be sent to the particular contact. So this way you can send SMS to the particular contact.

Send Fax

Mostly businesses often use fax. Fax is the more secure and reliable way to share the documents instead of the instant messaging.

You must have configured a provider in ICTCore for sending fax. If you don't know how to configure a provider view this link.

Step 1: Create Fax Document

Firstly create your fax document and than upload it to ICTCore.

REST API for creating fax document

    POST http://ictcore.example.com/api/messages/documents

Document Object

    name: string
    description: string

REST API Example using PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/messages/documents");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
      \"name\": \"group name\",
      \"description\": \"Description\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the document_id of recently created record.

Step 2: Upload Document File

Upload media / pdf file for an existing document, this method should be called followed by POST messages/documents. Supported file types are pdf, jpg, jpeg and png.

REST API for uploading document file

    PUT http://ictcore.example.com/messages/documents/document_id/media

Required parameter

    document_id: ID of the document in the form of an integer

REST API Example using PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/messages/documents/document_id/media");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

    curl_setopt($ch, CURLOPT_POSTFIELDS,  Pdf file content here);

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/pdf"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the document_id of recently updated record.

Step3: Create Send Fax program

Now we need to create the send fax program and and make it ready to be sent

REST API for Send Fax program

    POST http://ictcore.example.com/api/programs/sendfax

Program Object

    name: string
    document_id: number // document_id of fax document for which this program is being created

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/programs/sendfax");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
      \"name\": \"name\",
      \"document_id: 1 (number ) - document_id of fax document for which this program is being created\": \"\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the program_id of recently created record.

Step4: Create Send Fax transmission

REST API for Creating Fax transmission

    POST http://ictcore.example.com/api/transmissions

Transmission Object

    title: string
    program_id: number
    phone: number
    origin: string
    direction: string

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/transmissions");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
      \"title\": \"title\",
      \"phone\": 1234231,
      \"program_id\": 1,
      \"origin\": \"origin\",
      \"direction\": \"direction\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the transmission_id of recently created record.

Send Fax Transmission

Now the transmission is successfully created, now next step is to send that transmission.

REST API for Send Fax Transmission

    POST http://ictcore.example.com/api/transmissions/transmission_id/send

Required parameters

    transmission_id : number // ID of the transmission in the form of an integer

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/transmissions/transmission_id/send");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Now the document will be forwarded to the particular contact.

Send Email

Email marketing is the use of email to promote products or services while developing relationships with potential customers or clients. It is essentially direct mail done electronically instead of through the postal service.

You must have configured a provider in ICTCore for sending email.

Step 1: Create Email template

Firstly create your email template and than upload it to ICTCore.

REST API for creating email template

    POST http://ictcore.example.com/api/messages/templates

Template Object

    name: string
    description: string
    subject: string //required
    body: string // required field, it contains the HTML message
    body_alt: string // it contains the plain message
    type: string // three digit file extension representing file type

REST API Example using PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/messages/templates");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
     \"name\": \"name\",
     \"description\": \"Description\",
     \"subject\": \"Subject\",
     \"body\": \"body\",
     \"body_alt\": \"body alt\",
     \"type\": \"file extension\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the template_id of recently created record.

Step 2: Upload Template File

Upload media / attachment for an existing template, this method should be called followed by POST messages/templates

REST API for uploading template file

    PUT http://ictcore.example.com/api/messages/templates/template_id/media

Required parameter

    template_id: ID of the template in the form of an integer

REST API Example using PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/messages/templates/template_id/media");       
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

    $fields = &lt;&lt;&lt;EOT
      file content here
    EOT;
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: text/plain"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the template_id of recently updated record.

Step3: Create Send Email program

Now we need to create the send email program and and make it ready to be sent

REST API for Send Email program

    POST http://ictcore.example.com/api/programs/sendemail

Program Object

    name: string
    template_id: 1 (number ) - template_id of email template for which this program is being created

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/programs/sendemail");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
    \"name\": \"name\",
    \"template_id: 1 (number ) - template_id of email template for which this program is being created\": \"\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the program_id of recently created record.

Step4: Create Send Email transmission

REST API for Creating Email transmission

    POST http://ictcore.example.com/api/transmissions

Transmission Object

    title: string
    program_id: number
    phone: number
    origin: string
    direction: string

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/transmissions");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, "[
    {
      \"title\": \"title\",
      \"phone\": 1234231,
      \"program_id\": 1,
      \"origin\": \"origin\",
      \"direction\": \"direction\"
    }
    ]");

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

Response

It will return the transmission_id of recently created record.

Send Email Transmission

Now the transmission is successfully created, now next step is to send that transmission.

REST API for Send Email Transmission

    POST http://ictcore.example.com/api/transmissions/transmission_id/send

Required parameters

    transmission_id: number // ID of the transmission in the form of an integer

REST API EXAMPLE USING PHP

    <?php
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://ictcore.example.com/api/transmissions/transmission_id/send");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Content-Type: application/json"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);

 

Now the email will be forwarded to the particular contact.