salesforce-marketingcloud / sfmc-example-jb-custom-activity

Custom activity examples for Journey Builder.
BSD 3-Clause "New" or "Revised" License
111 stars 142 forks source link

Question: Clarification on HTTP status codes and error signaling in custom activity response #20

Closed gatlinhebert closed 2 years ago

gatlinhebert commented 3 years ago

We continue to get a lot of value out of our custom activity and we're looking to make some improvements for our customers. Thanks for putting together this sample!

We have a custom activity that receives contact attributes via data binding and does some processing. Occasionally, while journeys are running we can receive requests that are invalid. For example, the contact might be missing certain required attributes and we can't process the request. Currently, we send a 400 response to JB when this happens. Can you clarify how HTTP status codes impact the journey? From my limited testing, it appears that when my custom activity returns a 400 it's counted as a success and the contact continues on to the next activity in the journey. This is not what I was expecting given this comment.

Additionally, we've had customers ask for better reporting in SFMC when these types of failures occur. What I'm hoping for is a way to signal a status back to JB so customers can monitor failed contacts. Similar to how hard/soft failures are displayed for an Email activity.

Email example with hard/soft errors:

Screenshot at Jul 01 10-40-50 Screenshot at Jul 01 10-37-25

Detailed view, note the status detail:

Screenshot at Jul 01 10-37-53

I've considered passing a status value back through the activity's out arguments but would prefer to use any journey builder features that are built-in.

fib-at-isobar commented 2 years ago

Hello @gatlinhebert, Have you managed to find a solution to this, please? Filip

gatlinhebert commented 2 years ago

Hi @fib-at-isobar,

I was not able to find a way to signal a "soft" failure back to SFMC but I did discuss this use case and share some feedback with the product team. From that discussion this is my current understanding of what's possible:

If your custom activity service responds with a 500 status, the contact will be ejected from the journey and will not proceed through any downstream activities. That will be marked as a "hard" error. There is not currently a way to mimic the types of "soft" failures that you see in the UI and with other first-party SFMC activities. Any 4XX status is marked as success in the UI and the journey log and the contact will continue through the journey.

I hope that helps! If you're looking for similar functionality I would suggest sharing your use case with the SFMC team.

fib-at-isobar commented 2 years ago

@gatlinhebert Hello! thanks for the response. That's shame. It would be great to know, how to send some message back to Journey Builder. BTW, Even HTTP 40X seems to create "Hard Error" scenario. Maybe it changed recently.