Step 8 – 2 Way Messaging/Replies

The options for 2 way messaging (sending and receiving messages using fmSMS) will depend on the SMS Gateway that you use, the Sender ID that you use and how you host fmSMS:

  1. Some SMS Gateways allow you to “poll” their server for any replies to messages sent from a shared virtual mobile number or a dedicated virtual mobile number. This requires  manual intervention – someone needs to click the Incoming Messages button in the Account details screen to initiate this process. This method is supported when fmSMS is hosted/opened in FileMaker Pro or hosted by FileMaker Server.
  2. Most SMS Gateways that offer 2 way messaging will have an option to “push” incoming messages to you automatically in a similar way to how automatica Delivery Receipts are delivered. This is also our preferred method, but it does require that fmSMS be hosted by FileMaker Server and that you configure the Customer Web Publishing service. A static IP address is also recommended as you have to provide the SMS Gateway with a URL to a php page on your server. We provide the necessary PHP pages that convert the incoming message into a record in the Replies table in fmSMS. Some Gateways charge additional fees to use this feature and if you require a dedicated virtual number you will need to rent/purchase one through your SMS Gateway.

Manually Check for Replies

To manually check for new Replies in fmSMS (where supported by your SMS Gateway) click on the ACCOUNTS button at the top of the screen to view your list of Accounts. Click the green arrow button to view the details for the Account you wish to check for new replies, then click the Incoming Messages button (if the SMS Gateway associated with this fmSMS Account does not support manually checking for replies you will receive an alert).

fmSMS will then communicate with the SMS Gateway via one of the supported methods (HTTP POST or XML IMPORT), check for any new replies since it last checked and then download  any awaiting replies.

To view incoming Replies click on the REPLIES button at the top of the screen to view all existing Replies (you may need to click the Show All button on the FileMaker toolbar if you have Replies but none are showing):

Replies List

Replies List

Click the green arrow button to the left of the Reply From field to view the details for an individual Reply:

Reply Details

Reply Details

The following details are available for a Reply:

Reply ID – this is generated automatically by fmSMS and can be ignored

Sender – the name of the Contact (if found) who send the Reply

Sender Mobile – the mobile phone number of the sender of the Reply

Destination – the number for the Reply was sent to (typically a shared virtual number or a dedicated virtual number – not all SMS Gateways provide this)

Timestamp – the timestamp for the Reply

Gateway Message ID: the SMS Gateway ID/reference for this Reply

Gateway Reply Ref: if the SMS Gateways allows you to include a hidden unique identifier in outgoing messages sent from a shared virtual number this will also appear here. This can be used to match an incoming Reply with a previously sent Message

Reply Body: the text of the incoming Reply

To help you match an incoming Reply to a previously sent Message we display the following below the Reply Body field:

Previous Messages By Gateway Message ID: we use the Gateway Message ID to match the Reply to a previous sent Message from fmSMS

Previous Messages by Gateway Numeric ID: some Gateways don’t allow alphanumeric reference numbers to be used as the hidden identifier when sending Messages from shared virtual numbers (we always use the fmSMS Message ID, e.g. MG1106 or the numeric component where required). For these SMS Gateways that only allow numeric identifiers to be used we match on the numeric component of the fmSMS Message ID

Previous Messages to this Sender: all previous Messages sent from fmSMS to the mobile number of the sender of the Reply

Automatically Receiving Replies

As mentioned above many SMS Gateways also offer the option to automatically send Replies directly to your Server. This has the advantage of not having to manually check for new Replies – they will automatically appear in your copy of fmSMS. To set up automatic Replies you will require the following:

  1. your copy of fmSMS must be hosted by FileMaker Server/Server Advanced v12 or later
  2. you will need to deploy and configure Custom Web Publishing with PHP
  3. you will need a static IP address/domain name for the web server that is part of the FileMaker Server deployment (we need to provide the SMS Gateway with a URL to a php page that will be hosted on your Server)
  4. you need to install the sharedNumberReply.php and/or dedicatedNumberReply.php files (supplied as part of your purchase of fmSMS) on your Web Server and determine the URL to these pages from the outside. For example if your web server has a domain name of www.myserver.com and you create a folder called fmSMS and place the dedicatedNumberReply.php file inside the fmSMS folder the URL will be: http://www.myserver.com/fmSMS/dedicatedNumberReply.php

FileMaker Cloud Compatibility – if you’re using FileMaker Cloud to host fmSMS you will not be able to automatically receive incoming messages using the supplied PHP pages as FileMaker Cloud does NOT support Custom Web Publishing with PHP.

The web server “root” folders for the installation location of the PHP files for FileMaker Server v13 and later is:

Windows (HTTP or HTTPS):

[drive]:Program FilesFileMakerFileMaker ServerHTTPServerConf

where [drive] is the drive on which the Web Publishing Engine component of your FileMaker server deployment resides.

Mac OS X (HTTP): 

/Library/FileMaker Server/HTTPServer/htdocs

Mac OS X (HTTPS):

/Library/FileMaker Server/HTTPServer/htdocs/httpsRoot

N.B. the HTTPS options require a valid SSL certificate to be installed.

Once you have determined the URL to the dedicatedNumberReply.php and/or sharedNumberReply.php files you then need to update your account settings with your SMS Gateway to enable the automatic Replies option and provide the URL to these pages so they can sent the Replies for shared/virtual numbers to these pagse (these will then be converted into records in the Replies table).

The process for this is different for each SMS Gateway:

Clickatell

If you have a dedicated virtual number with Clickatell you can enable the automatic delivery of Replies to your hosted copy of fmSMS – Clickatell don’t support 2 way messaging with their shared virtual numbers. N.B. the Clickatell Americas Small Business API (Two-way) service includes a dedicated virtual number as standard.

  1. login to your Clickatell account via their website (remember to select the Developers Central product when logging in)
  2. from the Home page click Manage my Products
  3. under the My Two-Way Numbers section you should see an entry for your 2 Way Number – click on the Type (e.g. US Long Codes (Small Business):
Clickatell Replies 2 Way Numbers

Clickatell Replies 2 Way Numbers

  1. under the  
  2. enter your URL to your  dedicatedNumberReply.php file in the Target Address field
  3. click the  Save Changes button
Clickatell Callback Options

Clickatell Callback Options

SMS Global – Shared Virtual Numbers

  1. login to your SMS Global account via their website
  2. click Tools on the left hand menu
  3. enter your URL to your sharedNumberReply.php file in the Post replies to URL field under SMS and MMS
  4. click the Update Settings button at the bottom
SMS Global Replies Shared Number

SMS Global Replies Shared Number

SMS Global – Dedicated Virtual Numbers

  1. login to your SMS Global account via their website
  2. click Tools on the left hand menu then click Dedicated Numbers
  3. enter your URL to your dedicatedNumberReply.php file in the Post replies to URL field
  4. click the Update Settings button at the bottom

Twilio

  1. login to your Twilio account via their website
  2. click on Phone Numbers in the side navigation (or go to https://www.twilio.com/console/phone-numbers/incoming)
  3. Click on your Twilio Number to edit it, then under Messaging selected Configure with Webhooks/TwiML
  4. select A Message Comes in “Webhook” and enter the URL in the adjacent field
  5. set the HTTP method to POST.
  6. click Save

Screen Shot 2016-07-20 at 4.13.04 PM

If your preferred SMS Gateway is not listed here please let us know – we can easily modify the dedicatedNumberReply.php and sharedNumberReply.php  files for additional SMS Gateways that support this feature.