Sending messages to a single user or all followers

This service sends message(s) to a single user or to all followers. To send to all followers, set type to 1 and omit the address; this works asynchronously. When a user follows the service a session is created; sending a valid message to the service refreshes the session. A valid session between the service and the user is required to send a message. The JSON format expected by the service changes based on the message type sent to followers. See content type formats for details.

Format

Send the service username/password in the Header using Basic Authentication.

https://tims.turkcell.com.tr/tes/rest/spi/sendmsgserv

Request
FieldValueDescription
*txnidstringRequest id value
*receiverobject
*typeintAddress type of the recipient. Values: 0 -> Hashed address 1 -> All addresses following the service 2 -> MSISDN (plain number)
*addressstringAddress in the type specified by type. If type is 0, address is hashed (use the value provided by bipussu). If type is 1, the address must not be in the request. If type is 2, provide the address in 905XXXXXXXXX format.
*compositionobject
*listlistList of messages to send. At least 1 item is required.
*typeintMessage type. Values: 0 – Text 2 – Photo 3 – Audio 4 – Video 5 – Sticker 6 – Caps 7 – Location 9 – Finish Line 10 – Contact 13 – Template Media Message 14 – Document. Additional parameters depend on the selected type.
expireintSeconds until the message disappears. Values: 3, 5, 10, 60
ttlintTime to live. Seconds until the message expires and the send is cancelled.
Response
FieldValueDescription
*txnidstringRequest id value
*resultcodestringResponse code. 0 for success; for failures see Error Codes.
*listlistFilled if successful and reporting is available.
*resultcodeintSend result. 0 for success; otherwise see Error Codes.
*receiverstringRecipient.
*reportidstringId of the message sent to the user.
*numberofmessageintNumber of messages to the user.
*totalnumberofmessageintTotal number of messages sent to the user.

Example: Sending a video

{
    {  
    "txnid": "156",  
    "receiver": {  
        "type": 2,
        "address": "9053XXXXXXXX"
        }  
    },  
    "composition": {  
        "list": [{  
            "type": 4,  
            "message": "https://timsac.turkcell.com.tr/scontent/p2p/04032016/10/Vedb8d12f22a3ac286622841e61203b2d09805a24c893c47548d98ef675e771295.mp4",  
            "size": 120,  
            "ratio": 1  
        }]  
    }  
}

Successful Response (Without Reporting)

{  
    "txnid": "156",  
    "resultcode": 0  
}  

Successful Response (With Reporting)

{  
    "txnid": "200",  
    "resultcode": 0,  
    "list": [{  
        "resultcode": 0,  
        "receiver": "905XXXXXXXXX",  
        "reportid": "34cvA-2542",  
        "numberofmessage": 1,  
        "totalnumberofmessage": 1  
    }]  
}  

Error Response

{  
    "txnid": "156",  
    "resultcode": 312  
}  

Example: Sending text to all followers

Request
{  
    "txnid": "2200",  
    "receiver": {  
        "type": 1  
    },  
    "composition": {  
        "list": [{  
            "type": 0,  
            "message": "test"  
        }]  
    }  
}  
Response
{  
    "txnid": "2200",  
    "resultcode": 0  
}
⚠️ Sending to all followers is asynchronous, so report IDs are not returned in the request response. Report IDs are sent to the callback URL + /report. Delivery/read reports for these report IDs are listened to from the service callback URL. See the reporting section for details.

Validations

Address value:

  • If type is 0 (hashed number), it must not be null or empty. [1008]
  • If type is 1 (all followers), it must not be included in the request. [1008]
  • If type is 2 (plain number), it must not be null or empty, must be 3–15 characters long, and must be MSISDN (E164 format). [1008]

Error Codes

resultcodeDescription
1000invalid txnid
1001invalid expire value
1002invalid content
1008invalid receiver address