Skip to content

Instantly share code, notes, and snippets.

[TestMethod]
public void Should_Not_Send_Sms_Message_From_Nonowned_Number()
{
var message = Notifications.CreateMessage(NONOWNED_FROM_NUMBER, TO_NUMBER);
message.Send(TEST_ACCOUNTSID, TEST_AUTHTOKEN);
Assert.AreEqual(MessageStatus.Fail, message.Status);
}
[TestMethod]
public void Should_Initiate_Outbound_Call_Successfully()
{
var call = Notifications.CreateCall(TO_NUMBER);
call.Initiate(TEST_ACCOUNTSID, TEST_AUTHTOKEN);
Assert.AreEqual(CallStatus.Success, call.Status);
}
[TestMethod]
public void Should_Not_Initiate_Outbound_Call_To_International_Number()
{
var call = Notifications.CreateCall(INTERNATIONAL_FAIL_TO_NUMBER);
call.Initiate(TEST_ACCOUNTSID, TEST_AUTHTOKEN);
Assert.AreEqual(CallStatus.Fail, call.Status);
}
[TestMethod]
public void Should_Populate_Customer_PhoneNumber()
{
var customer = new Customer(TEST_ACCOUNTSID, TEST_AUTHTOKEN);
var result = customer.BuyNumber(VALID_AVAILABLE_NUMBER);
Assert.IsTrue(result);
Assert.AreEqual(VALID_AVAILABLE_NUMBER, customer.PhoneNumber);
}
[TestMethod]
public void Should_Buy_PhoneNumber_From_NoneAvailable_Area_Code()
{
var customer = new Customer(TEST_ACCOUNTSID, TEST_AUTHTOKEN);
var result = customer.BuyNumberFromAreaCode(AREA_CODE);
Assert.IsFalse(result);
}
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="customTab" label="TWILIOSO" insertAfterMso="TabHome">
<group id="customGroup" label="Messages">
<button id="customButton1" label="Send SMS" size="large" onAction="conSendSms" imageMso="twiliologo" />
</group>
</tab>
</tabs>
</ribbon>
Public Sub conSendSms(control As IRibbonControl)
MsgBox “Hello World”
End Sub
Private Sub btnSend_Click()
Dim i As Integer
For i = 1 To Selection.Rows.Count
‘ Send a text message here
Next i
Me.Hide
End Sub
Function SendSMS(fromNumber As String, toNumber As String, body As String)
Dim SmsUrl As String
On Error GoTo Error_Handler
' setup the URL
SmsUrl = BASEURL &amp; "/2010-04-01/Accounts/" &amp; ACCOUNTSID &amp; "/SMS/Messages"
' setup the request and authorization
Dim http As MSXML2.XMLHTTP60
For i = 1 To Selection.Rows.Count
SendSMS "+17045943984", Selection.Cells(i, CONTACTNUMBERCOLUMNINDEX), Me.txtMessage
Next i