APIs & Integrations

_prosen
Participant

Workflow enrollments contract is not sending the email multiple times

SOLVE

i am using the below API to enroller the contract. I am enrolling the contact depending on a scheduler, and facting the data from our internal DB and enrolling the contact also we are updating our internal data depending on the API response so that we can make sure we have successfully sent the email to the user(the API is responding with 204 which is success response) but if i enroller same email multipule times it is only sending the email once.

POST `${host_v2}/workflows/:workflowId/enrollments/contacts/:userEmail?hapikey=API_KEY`

Actual: Enrolling same contact 3 times and getting single email.
Expected: By enrolling same contact 3 times should send 3 seperate email.

Code snip:

 

...
mergeMap(([email]) => {
    return forkJoin([
        of(email),
        this.enrollContactIntoWorkflow(email, workflowId),
    ]);
}),
filter(([ email, res]) => res.status === 204),
...

async enrollContactIntoWorkflow(email: string, workflowId: string) {
    return lastValueFrom(
      this.httpService.post(
        `${host_v2}/workflows/:workflowId/enrollments/contacts/:email?hapikey=API_KEY`,
        {},
      ),
    );
  }

 

 

0 Upvotes
1 Accepted solution
coldrickjack
Solution
Top Contributor

Workflow enrollments contract is not sending the email multiple times

SOLVE

Hey @_prosen,

 

When you say enroll the email multiple times do you mean at varying intervals or are you trying to add the same email multiple times instantly? The reason I ask is because if it's the latter there isn't a way to get this to work unless you throttle your request.  A single contact can't be enrolled in a workflow more than once at a single point in time. They can certainly be re-enrolled when they complete the workflow providing the workflow is setup for re-enrollment. In otherwords they have to complete the workflow before they're enrolled again. 

View solution in original post

2 Replies 2
coldrickjack
Solution
Top Contributor

Workflow enrollments contract is not sending the email multiple times

SOLVE

Hey @_prosen,

 

When you say enroll the email multiple times do you mean at varying intervals or are you trying to add the same email multiple times instantly? The reason I ask is because if it's the latter there isn't a way to get this to work unless you throttle your request.  A single contact can't be enrolled in a workflow more than once at a single point in time. They can certainly be re-enrolled when they complete the workflow providing the workflow is setup for re-enrollment. In otherwords they have to complete the workflow before they're enrolled again. 

_prosen
Participant

Workflow enrollments contract is not sending the email multiple times

SOLVE

Thanks for your response. yes, i tried instantly. so i have to wait untill the workflow completed.