Send a text message
Sends a text message from one of your numbers to a phone number, with your own text or a saved template.
Messages are billed to your dialer balance.
Parameters
Send as application/x-www-form-urlencoded.
typestringrequiredSelects the operation. Always
send_text_messagefor this endpoint.tokenstringrequiredYour API token from Log in. See Authentication.
Your DCDial company ID.
Example101Phone number in E.164 or 10-digit US format.
Example5551234567Caller ID (a number assigned to your company).
Example5559876543Y to send a saved SMS template instead of sms_text.
One ofYNMessage body.
ExampleYour payment of $150.00 was received. Thank you!
curl https://api.dcdial.com/api/ \ -d type=send_text_message \ -d token="$DCDIAL_TOKEN" \ -d company_id=101 \ -d phone_number=5551234567 \ -d caller_id=5559876543 \ -d use_template=Y \ -d sms_text='Your payment of $150.00 was received. Thank you!'<?php$ch = curl_init('https://api.dcdial.com/api/');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => http_build_query([ 'type' => 'send_text_message', 'token' => getenv('DCDIAL_TOKEN'), 'company_id' => 101, 'phone_number' => '5551234567', 'caller_id' => '5559876543', 'use_template' => 'Y', 'sms_text' => 'Your payment of $150.00 was received. Thank you!', ]),]);$result = json_decode(curl_exec($ch), true);curl_close($ch);
if (($result['response']['success'] ?? 0) != 1) { throw new RuntimeException($result['response']['error'] ?? 'Request failed');}const res = await fetch('https://api.dcdial.com/api/', { method: 'POST', body: new URLSearchParams({ type: "send_text_message", token: process.env.DCDIAL_TOKEN, company_id: "101", phone_number: "5551234567", caller_id: "5559876543", use_template: "Y", sms_text: "Your payment of $150.00 was received. Thank you!", }),});const { response } = await res.json();if (response.success != 1) throw new Error(response.error);import osimport requests
r = requests.post( "https://api.dcdial.com/api/", data={ "type": "send_text_message", "token": os.environ["DCDIAL_TOKEN"], "company_id": 101, "phone_number": "5551234567", "caller_id": "5559876543", "use_template": "Y", "sms_text": "Your payment of $150.00 was received. Thank you!", }, timeout=30,)response = r.json()["response"]if str(response.get("success")) != "1": raise RuntimeError(response.get("error")){ "response": { "success": "[0|1]", "message": "00000" }}Try it