Skip to content

Update campaign

Request

Update a campaign by ID.

Security
oauth2(Required scopes: borrowercampaign:update) or bearerAuth or apiKeyHeader
Path
borrowerCampaignIdstring(AnyId)^ext-|^[A-Z][A-Z0-9]-[A-Z0-9]+-[A-Z0-9]+|^\d+$write-onlyrequired

Peach's unique or lender's external identifier.

Bodyapplication/json
bulkSenderIdstring or null

The ID of an existing bulk sender to use for this campaign.

contactExporterIdstring or null

The ID of an existing contact exporter to use for this campaign.

redashApiKeystring or null

The API key to use for querying Redash.

You can find your API key at https://{YOUR_REDASH_DOMAIN}/users/me.

redashQueryUrl(General (string or null)) or (bulkSender (string or null)) or (bulkSender: paymentDueDateReminder (string or null)) or (bulkSender: loanOverdueNthNotice (string or null)) or (bulkSender: autopayPaymentReminder (string or null)) or (bulkSender: loginFirstPaymentReminder (string or null)) or (bulkSender: autopayEnableReminder (string or null)) or (bulkSender: autopayAmountChanged (string or null)) or (bulkSender: futurepayPaymentDueReminder (string or null)) or (bulkSender: loanRightToCurePersonalUnsecured (string or null)) or (bulkSender: cardExpiresReminder (string or null))
Any of:

The URL of the Redash query from which to build the input.

The URL should look like https://{YOUR_REDASH_DOMAIN}/queries/{QUERY_ID}.

The output of this query is fed into the campaign system as input for each new campaign run. (Note that the query is re-run on each campaign run.)

The query must produce a query result with at least the column borrowerId, e.g.:

borrowerId
4,
5,
...

Note that it is valid to use either public IDs (like BO-XXXX-XXXX) or internal database IDs (integers).

For a detailed description of how to format your query result see other options for this redashQueryUrl property.

<= 150 characters
string or null(General)
schedulestring or null

The schedule to run a campaign on, given in Peachy crontab time specification format.

Peachy crontab is an extension to crontab(5) that adds a time specification value 'P', which means "Peach decides". Currently, the minute and hour fields must be 'P' (i.e., you can not specify the time of the day), and the day-of-month, month, and day-of-week fields must NOT be 'P'.

Some examples of Peachy crontabs: P P 1,15 * *: Run on the 1st and 15th of every month P P * * wed: Run every Wednesday P P * 10 *: Run every day in October

See https://crontab.guru/ for an expression builder.

If null the campaign does not run on a schedule (and therefore must be run manually).

sftpSettingsobject or null

The SFTP settings to be used to upload the results of a campaign run.

At the completion of a campaign run, if these settings are specified, they are used to SFTP upload the files created as a result of the run.

These files include the exporter contacts .csv file and the log file.

The file names for these files will be:

  • {CAMPAIGN_ID}_{TIMESTAMP}_query_results.csv
  • {CAMPAIGN_ID}_{EXPORTER_ID}_{TIMESTAMP}.csv
  • {CAMPAIGN_ID}_{EXPORTER_ID}_{TIMESTAMP}.csv
  • {CAMPAIGN_ID}_{EXPORTER_ID}_{TIMESTAMP}_log.txt
PUT
/campaigns/{borrowerCampaignId}
curl -i -X PUT \
  'https://sandboxapi.peach.finance/api/campaigns/{borrowerCampaignId}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "bulkSenderId": "string",
    "contactExporterId": "string",
    "redashApiKey": "string",
    "redashQueryUrl": "https://acme-rd.peach.finance/queries/48",
    "schedule": "string",
    "sftpSettings": {
      "cdDir": "string",
      "host": "sftp.acme.com:23",
      "password": "string",
      "username": "string"
    }
  }'

Responses

Success

Bodyapplication/json
messagestring

Description of the server action or error.

statusinteger

HTTP status code.

dataobject(BorrowerCampaignFull)

A borrower campaign is part of a system for exporting contact information for borrowers or sending communications to borrowers in bulk.

A borrower campaign objects represents this campaign. It contains the information specifying from where a campaign derives its input borrower list, a schedule for execution, and the format for exporting that list.

The input borrowers list is defined by a Redash query. See redashQueryUrl for details.

Response
{ "message": "string", "status": 0, "data": { "createdAt": "2019-08-24T14:15:22Z", "deletedAt": "2019-08-24T14:15:22Z", "id": "string", "updatedAt": "2019-08-24T14:15:22Z", "externalId": "string", "bulkSenderId": "string", "contactExporterId": "string", "redashApiKey": "string", "redashQueryUrl": "https://acme-rd.peach.finance/queries/48", "schedule": "string", "sftpSettings": { … } } }