How Can We Help?

API Action Reference

Invocable action name: SubscriberUserStatusInvocable

This action can be used to set the status for one or more Fastcall users. If done this way, the user status change will be broadcasted and a proper log will be kept for the user status change.

Parameters

  • userId – Id – Required. The Salesforce Id of the user whose Fastcall status will be changed.
  • userStatusId – Id – Required. The Id of the Fastcall User Status that will be set for the User.
  • statusType – String – Optional. Status Type: Available, Offline. If a userStatusId is not provided, or the referenced User Status is not found, then the user availability is set to the one provided in the statusType parameter.

Throws

FastCall.SubscriberAPI.APIException – If an error occurs, an instance of APIException is thrown.

Invocable action name: InvocableMessage

This action can be used to send SMS or MMS messages, to any Salesforce record of any object type, as well as to any phone number (i.e. doesn’t need an existent record in Salesforce to get the call initiated).

Parameters

  • bodyText – String – Required. Body of the SMS/MMS message.
  • fromPhone – String – Optional. Phone number used as the outbound Caller ID when sending the message. If not provided, Fastcall will look for a suitable phone number with SMS capabilities and enabled for sending outbound SMS, to which the user has access either directly, or through a group (see Assignment / Available For, in the phone number detail page in the Fastcall Settings tab).
  • mediaURL – String – Optional. URL of the media you want to include with your message. Supported media formats are GIF, PNG, and JPEG.
  • phoneNumberFieldName – String – API Name of the record field that holds the phone number to be dialed.
  • recordId – Id – Optional. Salesforce record Id, associated with the phone number specified in “toPhone”. If provided, Fastcall will associate the SMS record to the Salesforce record, and will also create a Task record associated with this record.
  • templateId – Id – Optional. Salesforce Id of the Fastcall SMS Template to use for the body. You can get this ID from the template’s details page in the Fastcall Settings. Otherwise, the message’s body is taken from the bodyText parameter.
  • toPhone – String – Required. The destination phone number for the message is usually a phone number from a Salesforce record phone number field.
  • userId – Id – Optional. If you provide the userId parameter, but not the fromPhone, then the Caller Id will be resolved based on that User, instead of the User executing the Flow or Trigger. The User must be a Fastcall User and must have Caller IDs available with support for SMS, otherwise, the action is going to fail.

    If you don’t provide the userId parameter, then the User actually invoking the action must be a Fastcall User, and have at least one Caller ID available, otherwise, it will fail.

Example

Here’s an example demonstrating how you can implement it within a Batch Apex class:

public class SMSData {
        public ID recordID;
        public String phoneNumberFieldName;
        public String toPhone;
        public String fromPhone;
        public String bodyText;
        public String mediaURL;
        public List<String> mediaURLs;
        public String userId;
        public String templateId;
}

public class SMSSendError {
    public String errorMessage;
    public SMSData smsData;
    public SMSSendError(String errorMessage, SMSData smsData) {
        this.errorMessage = errorMessage;
        this.smsData = smsData;
    }
}

global with sharing class SMSSenderBatch implements Database.Batchable<SMSSenderBatch>,
Database.AllowsCallouts, Database.Stateful {

    private final List<SMSData> smsDataList;
    private final List<SMSSendError> errors;

    public SMSSenderBatch(List<SMSData> smsDataList) {
        this.smsDataList = smsDataList;
        this.errors = new List<SMSSendError>();
    }

    global Iterable<SMSData> start(Database.BatchableContext info){ 
        // Must implement SMSData iterator
        return new SMSDataIterator(this.smsDataList); 
    }

    global void execute(Database.BatchableContext info, List<SMSData> scope){

        for(SMSData msgData : scope) { 

            try {

                FastCall.SubscriberAPI.executeAction('SMS.Send', new Map<String, Object> {
                    'fromPhone'   => msgData.fromPhone,
                    'toPhone'     => msgData.toPhone,
                    'userId'      => msgData.userId,
                    'recordId'    => msgData.recordID,
                    'bodyText'    => msgData.bodyText,
                    'mediaURL'    => msgData.mediaURL,
                    'mediaURLs'   => msgData.mediaURLs,
                    'templateId'  => msgData.templateId
                });

            } catch (Exception e) {

                this.errors.add(new SMSSendError(e.getMessage(), msgData));
                System.debug('Error sending SMS: ' + e.getMessage());
            }

        }
    }   

    global void finish(Database.BatchableContext info){

        // Handle errors if any
        if(!this.errors.isEmpty()) {
            // Log errors or send notifications
            for(SMSSendError error : this.errors) {
                System.debug('Error: ' + error.errorMessage);
                System.debug('SMS Data: ' + error.smsData);
            }
        }
    } 
}

This helps illustrate how to call the SMS.Send action from within a Batch class.

Returns

In the example above, the FastCall.SubscriberAPI.executeAction method returns an object containing the properties of the message that was just sent, assuming the operation is successful.

For example:

Map<String,Object> result = (Map<String,Object>) FastCall.SubscriberAPI.executeAction(
    'SMS.Send', 
    new Map<String,Object> {
        'fromPhone'   => msgData.fromPhone,
        'toPhone'     => msgData.toPhone,
        'userId'      => msgData.userId,
        'recordId'    => msgData.recordID,
        'bodyText'    => msgData.bodyText,
        'mediaURL'    => msgData.mediaURL,
        'mediaURLs'   => msgData.mediaURLs,
        'templateId'  => msgData.templateId
    }
);

Map<String, Object> with the following properties:

  • id – Id – Salesforce record ID for the FastCall__SMS_Message__c record.
  • smsId – Id – VoIP provider resource ID for the message.
  • taskId – Id – Salesforce Task ID for the message record.
  • relatedRecordId – String – Salesforce ID of the record associated with the message (Lead, Contact, any record from any standard or custom object type).
  • direction – String – Outbound or Inbound.
  • status – String – Current status for the message
  • phoneNumberId – String – Salesforce ID of the Fastcall Phone Number used as Caller ID for sending the message.
  • ownerId – String – ID of the Salesforce User or Group set as the owner for the message.
  • createdDate – String – DateTime when the message was initially enqueued for delivery.

NOTE: The delivery status for the message is updated in real-time in the FastCall__Status__c field of the FastCall__SMS_Message__c record. So you can track the delivery status of the message by inspecting the FastCall__SMS_Message__c record having the id value provided in the response.

Throws

FastCall.SubscriberAPI.APIException – If an error occurs, an instance of APIException is thrown, with one of the following error codes:

  • 100 – SMS could not be sent. Check the VoIP error logs.
  • 101 – Body text not provided.
  • 103 – Caller ID not found. The Fastcall Admin should provision an SMS capable phone number as Caller ID for the user sending the message.
  • 104 – SMS could not be sent. A generic message will contain a more detailed explanation about the issue.
  • 105 – The Fastcall setup is missing the SMS capability. Contact Fastcall Support to enable the SMS capability.

Result

The result of invoking the FastCall_InvocableMessage action will be an object of type SendMessageResponse

The object has the following properties:

@InvocableVariable(label='Response Message' 
description='Response message from the "sendMessages" operation.')
String responseMessage;
@InvocableVariable(label='Batch Job ID' 
description='The ID of the Batch Apex job that will send the messages.')
String batchJobId;
@InvocableVariable(label='Message IDs' 
description='List of message IDs that were created.')
List messageIds;

Invocable action name: InvocableCall

Starts an outbound call using Fastcall. When the called party answers, it is connected to a Fastcall IVR (Menu, ACD Call Transfer, Voice Mail, etc.).

Parameters

  • fromPhone – String – Optional. Phone number used as the outbound Caller ID. If not provided, Fastcall will try to select one among the phone numbers assigned to the user directly or through a group, that are available for usage as Caller IDs.
  • ivrId – String – The Salesforce ID of a Fastcall IVR. This IVR will be executed when the called party answers. It can be an IVR of any type.
  • phoneNumberFieldName – String – API Name of the record field that holds the phone number to be dialed.
  • recordId – String – Optional. If provided Fastcall will associate the FastCall__Call__c record with this Salesforce record. The Task created will also be associated with this same record.
  • toPhone – String – Required. The destination phone number for the Call. This is usually a value taken from a Salesforce record phone number field.
  • userId – String – Optional. If you provide the userId parameter, but not the fromPhone, then the Caller ID will be resolved based on that User, instead of the User executing the Flow or Trigger. The User must be a Fastcall User and must have Caller IDs available with support for Voice Calls, otherwise the action is going to fail.

    If you don't provide the userId parameter, then the User actually invoking the action must be a Fastcall User, and have at least one Caller ID available, otherwise, it will fail.

Returns

Map<String, Object> with the following properties:

  • callId – String – VoIP provider resource ID for the call.
  • direction – String – Outbound or Inbound.
  • id – String – Salesforce record ID for the FastCall__Call__c record.
  • ivr – String – Salesforce ID of the Fastcall IVR that the call was connected to.
  • owner – String – ID of the Salesforce User or Group set as the owner of the call.
  • relatedRecordId – String – Salesforce ID of the record associated with the call (Lead, Contact, any record from any standard or custom object type).
  • startTime – String – DateTime when the call was initially enqueued for dialing.
  • status – String – Initial status for the call.
  • taskId – String – Salesforce Task ID for the call.

Result

The result of invoking the FastCall_InvocableCall action will be an object of type StartCallsResponse

The object has the following properties:

@InvocableVariable(label='Response Message' 
description='Response message from the "newCall" operation.')
String responseMessage;
@InvocableVariable(label='Batch Job ID' 
description='The ID of the Batch Apex job that will start the calls.')
String batchJobId;
@InvocableVariable(label='Call IDs' 
description='List of call IDs that were created.')
List callIds;

Invocable action name: InvocablePhoneNumberLookup

This method allows you to search for a Salesforce record based on a phone number, following Fastcall’s configured search settings.

Parameters

  • phoneNumber – String – Phone number used as the inbound Caller ID.
  • recordId – String – The Salesforce ID of the matching record, if found.
  • recordName – String – The name of the matched record.
  • objectType – String – Object API name.

Result

The result of invoking the FastCall_InvocablePhoneNumberLookup action will be an object of type PhoneNumberLookupResult

The object has the following properties:

@InvocableVariable(label='Record ID' 
description='The ID of the record associated to the phone number.')
String recordId;
@InvocableVariable(label='Record Name' 
description='The name of the record associated to the phone number.')
String recordName;
@InvocableVariable(label='Object Type' 
description='The type of the object associated to the phone number.')
String objectType;
@InvocableVariable(label='Record Owner ID' 
description='The ID of the Salesforce record owner.')
String recordOwnerId;
Ready to Install the Last Version?

Click on the button and download package from the Appexchange