Skip to content

Facebook Response Gatherer

The FastStats Facebook Response Gatherer (FFRG) collects campaign responses from Facebook and stores them in the Social database, making them available in PeopleStage reports.

Installation

The Facebook Response Gatherer installer is in the DigitalIntegration.zip file in the Apteco Software Releases area of the Apteco portal.

  1. Extract DigitalIntegration.zip to the PC where you want the response gatherer to run.
  2. Run FacebookResponseGatherer64Setup.msi and follow the installation wizard.

    Facebook Response Gatherer installation directory

The default installation directory is C:\Program Files\Apteco\FastStats Facebook Response Gatherer x64. We recommend installing in your FastStats application files directory on the FastStats Application Server, but the gatherer can run on any PC in your system.

Configuration

After installation, edit FacebookResponseGatherer64.exe.config in the installation directory to update the following settings:

  • Connection string for the Social database (SO_)
  • Connection string for the Control database (WS_)
  • Bulk Insert directory
XML
<configuration>
  <add key="db_connection_facebook" value="Data Source=localhost;Initial Catalog=SO_TealHols;User Id=faststats_service;Password=fa5t5tat5!;"/>
  <add key="db_connection_users" value="Data Source=localhost;Initial Catalog=WS_TealHols;User Id=faststats_service;Password=fa5t5tat5!;"/>
  <add key="db_bulkinsert_directory" value="C:\FastStats\Publish\TealHols\bulkinserts\"/>
  <add key="db_connection_timeout" value="1200"/>
  <startup/>
</configuration>

Note

Run Notepad as Administrator to save changes to files within Program Files.

Folder structure

Create a folder structure to store the files used with the Response Gatherer. You can use any location and naming convention, but the directories must be referenced in the batch file.

A typical structure inside the FastStats directory:

Response Gatherer folder structure

The bulk insert directory must be accessible from the SQL Server, and the user running the SQL Server Service must have read permissions on it.

It is standard practice to place the batch file and a Logs subdirectory in a folder called FFRG within the FastStats base directory. Create the Logs subdirectory manually before running the batch file for the first time.

FFRG directory

Running the Response Gatherer

The FFRG is invoked from a batch file and scheduled via Windows Task Scheduler. The command syntax is:

Text Only
FacebookResponseGatherer64.exe <username> <password> <systemname> "TIMEPERIOD=7D"

Where TIMEPERIOD specifies how far back to gather responses—for example, 7D for 7 days, 2M for 2 months, 48H for 48 hours.

Example batch file

Batchfile
REM - Facebook Response Integration
@echo off
C:
cd C:\FastStats\FFRG
cls
SET FFRG="%ProgramFiles%\Apteco\FastStats Facebook Response Gatherer x64\FacebookResponseGatherer64.exe"
SET LOGFILE="Logs\TealHols.txt"
SET LOGFILEDETAILS="Logs\TealHols_Details.txt"
echo. >> %LOGFILE%
echo. >> %LOGFILEDETAILS%
echo %date% %time% - Starting FastStats Facebook Response Download >> %LOGFILE%
echo %date% %time% - Starting FastStats Facebook Response Download >> %LOGFILEDETAILS%
echo. >> %LOGFILE%
%FFRG% Administrator . TealHols "TIMEPERIOD=7D" >> %LOGFILEDETAILS%
IF ERRORLEVEL 9003 goto FailedException
IF ERRORLEVEL 9001 goto FailedDownload
IF ERRORLEVEL 9000 goto FailedLogin
:OK
echo %date% %time% - FastStats Gathered TealHols Facebook Responses OK >> %LOGFILE%
goto Complete
:FailedLogin
echo %date% %time% - FastStats Gatherer Failed - Login Failed >> %LOGFILE%
goto Complete
:FailedDownload
echo %date% %time% - FastStats Gatherer Failed - Downloading from Facebook >> %LOGFILE%
goto Complete
:FailedException
echo %date% %time% - FastStats Gatherer Failed - API Exception >> %LOGFILE%
goto Complete
:Complete
echo %date% %time% - Completed FastStats TealHols Facebook Response Download >> %LOGFILE%
Parameter Description
SET FFRG Location and name of the FFRG executable
SET LOGFILE Location and name of the log file
SET LOGFILEDETAILS Location and name of the detailed log file
Argument 1 FastStats system user—must be a user who has generated the Facebook Token
Argument 2 FastStats user password—a single character can now be used
Argument 3 System name
Argument 4 Time period to gather responses (e.g. TIMEPERIOD=1W, TIMEPERIOD=1D)

Scheduling with Windows Task Scheduler

  1. Open Windows Task Scheduler from the Start Menu.

  2. Select Create Basic Task.

  3. Create a Basic Task step: enter a Name and Description.

  4. Task Trigger step: select the trigger interval and enter the start date and time.

  5. Action step: select Start a program and click Next.

  6. Start a Program step: click Browse, navigate to the batch file, and select it. Optionally, add the XML configuration filename in the Add arguments box.

  7. Summary step: click Finish.

Create a task to run the FFRG as frequently as required:

FFRG Task Scheduler properties

FFRG Task Scheduler actions

Once the FFRG is running, responses are available in PeopleStage Facebook Reports immediately.

Facebook campaign responses in PeopleStage