Approval

Approval action is used to invoke an external system upon user approval

Approval actions are used to invoke another system and based on its response, let the user know the action was successful or not.

The URL can have attributes within it replaced with information from the action, as needed. The URL will be invoked via GET action and anything within 4xx range will be considered a failure and not retried. Anything above 500 will have a retry attempted, 3 times. Anything taking longer than 5 seconds will be stopped and not retried. When URL returns 400 or 500, action will be considered a failure.

  • {merchant} AVID of the merchant that the conversation was created by.
  • {customer} Customer the conversation was created for.
  • {business-process} ID of the conversation the action is contained within.
  • {action} ID of the action.
  • {event} Unique ID of the event that resulted in this approval attempt.

In addition to the properties above, you can reference any value placed within metadata as well.

If a secret is in the context, then there will be header attributes included in the GET request you can use to verify the origin. It follows the exact same logic as subscription verification.

No products are required to use this action.

This action pairs well with the following actions.

State

After resolution and this actions status will contain the response returned back from the URL invocation.

Union

When unioned to another action, the approval will not render with a button on web. Instead, the resolution of the unioned action will result in the invocation of the approval URL.

Macro level details for how union attribute behaves can be found within the Union documentation.

Features (required)

NameTypeDescriptionRules
actionstringDetermines the name of the action being approved. This will be used within the templates with verb conjugation to make the messages read better.
Examples: "approve".
MaxLength: 128
MinLength: 2
descriptionstring(required) Describes the thing/event/service where approval is being requested from. Used within messages so be sure your description is sensible.
Examples: "This is an example description.".
MaxLength: 65536
responsearrayUsed to pull information from the response and place it into the state of the topic. Useful if you want values returned to be made available in the webhook payload announced for this topic.
Examples: ["confirmation_number","message"].

Context

NameTypeDescriptionRules
secretstringUsed to generate a unique hash to send along with the callback invocation, to be sure the origin is trustable.
Examples: "example_secret_key".
MaxLength: 512
approvedstring(required) URL that is invoked when approval is granted. See above for interpolation details.
Examples: https://example.com/approved?merchant={merchant}.
MaxLength: 65536
MinLength: 3
Pattern: ^(https?://)([a-zA-Z0-9.-]+)(:[0-9]+)?(/[a-zA-Z0-9._~:/?#[]@!$&'()+,;=%-])?$
metadataobjectAny attribute provided within metadata can be referenced in the URL directly. No attribute may be named the same as any of the ‘default’ attributes.
Examples: {"name":"Joe"}.

Example

Below is an example payload for adding an action to a business process or blueprint.

{
    "type": "approval",
    "context": {
        "secret": "example_secret_key",
        "approved": "https://example.com/approved?merchant={merchant}",
        "metadata": {
            "name": "Joe"
        }
    },
    "features": {
        "action": "approve",
        "description": "This is an example description.",
        "response": [
            "confirmation_number",
            "message"
        ]
    }
}