Skip to main content
Closed for Voting

Test our Journey using minutes instead of days

  • May 27, 2021
  • 0 replies
  • 49 views

stevemc
Active Contributor
Forum|alt.badge.img+6

This is a mini “howto” I thought I’d share with the community.

I wrote a rather elaborate journey recently that is executed on the scale of days.  It involves sending welcome email for an online training course, sending reminder emails every week and then sending a series of “Last Week”, “Last day” and finally internal email if the learner does not finish.  Testing such a journey would be impractical even if I was to set the delay sequences to a small number of days.

I noticed its possible to set the Time delay in Journey blocks to Minutes but the contact record dates cannot be set to less than day resolution.  So I resorted to the REST API to set the date on the contact record to a resolution of hours and I tested a journey which changed  the value of “days” to “Minutes”.    I was thus able to test the entire flow in a mater of minutes :).

 

Below is description of my test setup where I verified this all works.  Hope this is useful to others.

 

I first tested and found that I could indeed set the H:M:S on the Training end date field in the contact record as follows with REST API:

curl -L -X PUT 'https://***.myfreshworks.com/crm/sales/api/contacts/16003608992' -H 'Content-Type: application/json' -H 'Authorization: Token token=**' --data-raw '{
    "contact": {
        "custom_field": {
            "cf_training_end_date": "2021-05-26T20:20:00-07:00"
        }
    }
}'

I then did a GET Contact API call and found that the date indeed remained the same as I set it with hours and minutes.

I then set up the following journey:

I set the "Add delay by contact field" to be 10 min before Training end date and set the Journey to trigger when contact Training status set to "Enrolled".  Since above I set the Training end date to 8:20, I expect at 8:10 the update would occur. 

At 8:08 PM I set the Training status to "Enrolled".  I observed that the count on the "Contact field matched" and "Add delay by contact date field" incremented by 1 and the "Update contact field" remained 0.

Right at 810 PM I found the contact record indeed updated and start date was decremented.

I confirmed this with REST API as follows:

  • Before 8:10: "cf_training_start_date": "2021-05-04T00:00:00-07:00",
  • After 8:10:    "cf_training_start_date": "2021-05-05T00:00:00-07:00",

 

I also found the journey had incremented the remaining 2 blocks: