Salesforce

From SMS Wiki
Revision as of 13:56, 17 June 2011 by Bzurkovic (Talk | contribs)

Jump to: navigation, search

With our service you can connect your SalesForce.com account to send text messages to one or more contacts. The sample code is provided for your convenience. Feel free to use it and improve for your purposes.


Instructions

1. This source code pack contains:

a) upsideWirelessSMSAPI.cls

  - Stubs generated by Salesforce wsdl2apex for the SOAP service

b) SMSAPI.cls

  - Connector class using upsideWirelessSMSAPI to send SMS messages to one or more Salesforce contact

2. Should the API definition changes and you have to regenerate the Apex stub classes, keep in mind that Salesforce wsdl2apex only supports wsdl with 1 porttype and 1 binding. Since SOAP service is used in this implementation, the wsdl needs to be trimmed down to remove porttype and binding other than 'SMSSoap'.

3. Classes and methods in upsideWirelessSMSAPI corresponding to those parts of the API that are not used in this implementation are commented out.

4. There are 2 versions of send SMS method in SMSAPI:

a) public Boolean sendSMS(Contact recipient, String message)

  - a simpler version that sends SMS to a single contact and returns a boolean to indicate success or failure

b) public Set<Id> sendSMSMultiple(List<Contact> recipients, String message)

  - sends SMS to multiple contacts and returns a set of contactIds to whom the send was successful

5. Limitations on number of recipients

a) The web services API supports up to 25 recipients. Your Salesforce app should limit the list of contacts

  passed into sendSMSMultiple() to 25 or fewer contacts. Or split long list of contacts into sublists 
  of no more than 25 and call sendSMSMultiple() multiple times.

b) Salesforce has a governor limit of 10 web services call in an apex request. So you can make at most 10 calls

  to sendSMSMultiple() in apex for a maximum of 250 recipients.

6. International phone number

a) To send to international mobile phone numbers outside the US, the reformatPhone() method needs to be modified to prepend the appropriate country codes.



back