How Can We Help?

Available SDKs

The different Fastcall Subscriber API “actions” can be invoked through 3 different means: Apex code, Process Builder & Flows, and Salesforce’s REST API.

Apex

When used from Apex, the API is exposed through a global class included in the Fastcall managed package that was installed from the AppExchange. The global class FastCall.SubscriberAPI has one single global method, which is used to invoke the different features & actions available in the API:

global Object executeAction(String actionName, Map<String, Object> actionData);

Parameters

  • actionName – String – The specific API method to invoke. Actions have the following naming convention: “FeatureName.ActionName“. E.g. “SMS.Send”, “Call.Start”, etc.
  • actionData – Map<String, Object> – Set of parameters for the action to be performed. The set of parameters available differ for each action and might include optional as well as mandatory parameters.

Returns

  • Object – Value(s) returned by the action invocation. The specific type and meaning of it will depend on the specific action invoked, and could also depend on execution-time factors.

Throws

  • FastCall.SubscriberAPI.APIException – If an error occurs, an instance of APIException is thrown, so you should catch & handle this exception type for a correct implementation.

Example

try {
         
    Map<String, Object> result; 
                
    result =  (Map<String,Object>) FastCall.SubscriberAPI.executeAction(
        ‘SMS.Send’, 
        new Map<String, Object> {
            ‘toPhone'   => 'xxx',
            'bodyText ' => 'This is an example about sending an SMS/MMS'
        }
    );
   
    System.assertEquals(‘SMS Queued’, result.get(‘status’));

} catch (FastCall.SubscriberAPI.APIException e) {
    // an exception has occurred while sending the SMS
}

Process Builder & Flows

Fastcall also provides each API action in a separate Apex method annotated with the Salesforce @InvocableMethod annotation. This means these API actions can be used from within a Process Builder or Flow definition.

Example

The Process Builder definition below sends an SMS message to new contacts. Then, after 3 days, it initiates an outbound call to the contact (e.g. to play a message, connect with an agent or group of agents, or any of the actions that can be set up via Fastcall IVRs).

Process Builder Diagram
Process Builder definition. It first validates that there’s a phone number set in the Contact record.
An SMS is sent right away. Fastcall will log every detail of it (delivery status etc) and associate it with the Contact
Process Builder Form
After 3 days, an outbound call is initiated to the Contact

REST API

Salesforce methods annotated as @InvocableMethods are also made available via the Salesforce REST API under an URL with the following format:

/services/data/vXX.X/actions/custom/apex/invocableName

After authenticating and authorizing access in Salesforce, you can make an HTTP POST request to the Fastcall action endpoint, passing the parameters in the HTTP request’s body formatted as JSON. This means you can initiate calls and send SMS/MMS messages using Fastcall, from any external system capable of interacting with the Salesforce REST API, including:

– Browser-based Javascript apps
– Any external application, written in any language and running on any platform, as long as it’s capable of authenticating & authorizing via OAuth 2.0 flows, and sending HTTP POST requests with a JSON payload on the HTTP request body

These messages and calls will be logged & updated in real-time in the Salesforce org, and associated with the proper record in Salesforce (i.e. a Lead, Contact, or any other standard or custom object record).

Example

The HTTP request below would start a call to a random phone number.

HTTP POST /services/data/v48.0/actions/custom/apex/FastCall__SubscriberCallInvocable

HTTP Body

{
    "inputs" : [ {
        "toPhone" : "+15553334444",
        "ivrId"   : "a0M0t00000CQT8kEAH"
    } ]
}