Sidebar Menu

SetPostbackURLForPhoneNumber

Assign a PostBackURL to a specific DID or short code.

Endpoint

GET (HTTP): https://messaging.cdyne.com/Messaging.svc/SetPostbackUrlForPhoneNumber?LicenseKey={LICENSEKEY}&PhoneNumber={PHONENUMBER}&Country={COUNTRY}&PostBackType={POSTBACKTYPE}&Url={URL}

Syntax

SetPostbackURLForPhoneNumber(LicenseKey, PhoneNumber, Country, PostbackType, Url)

Request Parameters

Parameter Name Description Data Type Required Sample Value
LicenseKey

License key associated with DID/short code.

GUID True f01d89fd-5155-5455-5585-e84ab8de8591
PhoneNumber

DID/short code to enable URL.

String True 15551234567
Country

Origin country of DID/short code.

String True US
PostbackType

Indicates whether PostBackURL is being used for incoming messages, outgoing messages, delivery receipts, or all messages associated with DID/short code.

Value Description
All

PostBackURL is used for all messages.

DeliveryReceipt

PostBackURL is used for delivery receipts.

IncomingMessage

PostBackURL is used for incoming messages.

OutgoingMessage

PostBackURL is used for outgoing messages.

String True All
Url

The URL that information will be posted to. The system posts OutgoingPostback objects for outgoing calls and IncomingPostback objects for incoming calls.

String True http://www.cdyne.com/postback.aspx

Response

Returns: String

Sample:
NoError

Value Description
NoError

The update was successful.

InvalidLicenseKey

The requested license key is invalid.

InvalidUrl

The requested URL is invalid.

InvalidPhoneNumber

The requested phone number is invalid.

InvalidPostbackType

The requested postback type is invalid.

NotFound

The requested resource was not found.

InvalidCountry

The requested country is invalid.

Code Samples

// https://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SetPostBackURLForPhoneNumber.WSDL;

namespace SetPostBackURLForPhoneNumber
{
    class Program
    {
        static void Main(string[] args)
        {
            MessagingClient client = new MessagingClient("mms2wsHttpBinding");
            SMSPostbackReturnCode resp = client.SetPostbackUrlForPhoneNumber(new Guid("f01d89fd-5155-5455-5585-e84ab8de8591"), "15559080983", "US", SMSPostbackType.All, "http://cdyne.com/postbackpage.aspx");

            Console.WriteLine("Error Setting Postback: " + resp);
            Console.ReadLine();
        }
    }
}
' https://messaging.cdyne.com/Messaging.svc?wsdl was added as Service Reference and given the name WSDL

Imports SetPostbackURLForPhoneNumber.WSDL

Module Module1

    Sub Main()

        Dim client As WSDL.MessagingClient = New MessagingClient("mms2wsHttpBinding")
        Dim resp As Boolean = client.SetPostbackUrlForPhoneNumber(New Guid("f01d89fd-5155-5455-5585-e84ab8de8591"), "15559080983", "US", SMSPostbackType.All, "http://cdyne.com/postbackpage.aspx")

        Console.Write("Error Setting PostBack: " + Convert.ToString(resp))
        Console.ReadLine()

    End Sub

End Module
Dim oXMLHTTP
Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Set oDoc = CreateObject("MSXML2.DOMDocument")

Call oXMLHttp.Open("GET", "https://messaging.cdyne.com/Messaging.svc/SetPostbackUrlForPhoneNumber?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591&PhoneNumber=15559080983&Country=US&PostBackType=All&URL=http://cdyne.com/postbackpage.aspx", False)
Call oXMLHttp.setRequestHeader("Content-Type", "text/xml")
Call oXMLHttp.send

MsgBox oXMLHTTP.responseText

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fso, MyFile, FileName, TextLine
Set fso = CreateObject("Scripting.FileSystemObject")
FileName = "c:\Users\Desktop\MMS.txt"

Set MyFile = fso.OpenTextFile(FileName, ForWriting, True)
MyFile.WriteLine oXMLHttp.responseText
MyFile.Close

Set MyFile = fso.OpenTextFile(FileName, ForReading)
Do While MyFile.AtEndOfStream <> True
  TextLine = MyFile.ReadLine
Loop
MyFile.Close

set request = nothing
<?php

$url = 'https://messaging.cdyne.com/Messaging.svc/SetPostbackUrlForPhoneNumber?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591&PhoneNumber=15559080983&Country=US&PostBackType=All&URL=http://cdyne.com/postbackpage.aspx';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));

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

print_r($response);

?>
require 'net/http'
require 'URI'

puts URI.methods
url = URI.parse("https://messaging.cdyne.com/Messaging.svc/SetPostbackUrlForPhoneNumber?LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591&PhoneNumber=15559080983&Country=US&PostBackType=All&URL=http://cdyne.com/postbackpage.aspx")
res = Net::HTTP.get_response(url)
data = res.body

puts data
gets data
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public final class SetPostbackUrlForPhoneNumber {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://messaging.cdyne.com/Messaging.svc/SetPostbackUrlForPhoneNumber?"
                            + "LicenseKey=f01d89fd-5155-5455-5585-e84ab8de8591"
                            + "&PhoneNumber=15553369037"
                            + "&Country=US"
                            + "&PostBackType=All"
                            + "&Url=http://cdyne.com/postbackpage.aspx");

            try {
                InputStream in = url.openStream();
                StreamSource source = new StreamSource(in);
                printResult(source);
            } catch (java.io.IOException e) {
            }
        } catch (MalformedURLException e) {
        }
    }

    private static void printResult(Source source) {
        try {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            StreamResult sr = new StreamResult(bos);
            Transformer trans = TransformerFactory.newInstance().newTransformer();
            Properties oprops = new Properties();
            oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
            trans.setOutputProperties(oprops);
            trans.transform(source, sr);

            System.out.println("**** Response ******");
            System.out.println(bos.toString());

            bos.close();
            System.out.println();
        } catch (Exception e) {
        }
    }
}