SmartValidate

Taggun's Smart Validate is an advanced feature designed to enhance receipt validation capabilities.

You can use AI to validate receipts based on any custom question, returning a simple true/false result.

How It Works

  1. Custom Prompts: Define your own validation rules by creating prompts that suit your needs.
  2. AI Interpretation: Taggun AI reads the receipt and applies your custom rules.
  3. Information Extraction: Key data is pulled from the receipt based on your prompts.
  4. Cross-Referencing: The extracted data is compared against your criteria.
  5. Result: The result is true/false, showing whether the receipt matches your rules.

Example

A)Request setting up the campaign rules with Smart Validate

curl --request POST \
     --url https://api.taggun.io/api/validation/v1/campaign/settings/create/coca-cola-03 \
     --header 'accept: application/json' \
     --header 'apikey: asdasdasdasdasdasd' \
     --header 'content-type: application/json' \
     --data '
{
  "date": {
    "start": "2022-01-01T00:00:00.000Z",
    "end": "2025-01-01T00:00:00.000Z"
  },
  "merchantNames": {
    "skip": true,
    "returnFromTheList": false
  },
  "productLineItems": {
    "skip": true,
    "totalPrice": {
      "min": 0,
      "max": 100
    },
    "quantity": {
      "min": 0,
      "max": 100
    }
  },
  "smartValidate": {
    "prompts": [
      {
        "question": "Does this receipt show a purchase of at least 2 Coca-Cola products?",
        "example": {
          "does_this_receipt_show_2_coca_cola_products": true
        },
        "skip": false
      }
    ]
  },
  "productCodes": {
    "skip": true
  },
  "balanceOwing": {
    "skip": false,
    "max": 0
  },
  "fraudDetection": {
    "allowSimilarityCheck": false
  }
}
'

A)Response for campaign set-up

{
  "campaignId": "{campaignId}",
  "status": "success",
}

B)Request for validating the receipt

curl --request POST \
     --url https://api.taggun.io/api/validation/v1/campaign/receipt-validation/file \
     --header 'accept: application/json' \
     --header 'apikey: YOUR_API_KEY' \  # Update to your API Key
     --header 'content-type: multipart/form-data' \
     --form 'file=@/path/to/receipt.jpg' \  # Update for your receipt file path
     --form 'campaignId={campaignId}'  \  # Update with your campaignId

Example file





















B) JSON Response for Receipt Validation - snippet containing smartValidate

{
  "successful": true,
  "failedValidations": [],
  "passedValidations": [
    "does_this_receipt_show_2_coca_cola_products"
  ],
  "smartValidate": {
    "does_this_receipt_show_2_coca_cola_products": true
  },
}

Explanation

  • "successful": true- The receipt passed all validation checks.
  • "failedValidations": [] - No checks failed.
  • "passedValidations"
    • "date_validated" - The purchase date is valid.
    • "does_this_receipt_show_2_coca_cola_products" - The receipt includes at least 2 Coca-Cola products, as specified by the campaign.
  • "smartValidate"- Confirms the rule was met:
    • "does_this_receipt_show_2_coca_cola_products": true- The receipt shows a purchase of at least 2 Coca-Cola products.

Benefits:

  • Creative Freedom: Design your own rules to make campaigns more engaging and fun.
  • Flexible Control: Tailor validations to your specific needs, putting the power in your hands.
  • Fast & Accurate: Quickly get reliable true/false results based on your criteria.
  • Easy Integration: Seamlessly add this feature to your existing workflow.

Best Practices

  • Be Specific: Use clear, unambiguous prompts that can be answered with a yes or no.
  • Test Thoroughly: Validate a variety of receipt types to ensure your prompts work as expected.
  • Iterate: Experiment with different prompts and receipts to fine-tune your prompts.
  • Consider Edge Cases: Account for variations in how products or services might be listed on receipts.

Considerations

  • The accuracy of validation depends on the quality of the prompts and the clarity of the receipt.
  • Complex validation criteria may need to be broken down into multiple yes/no questions.

Further Customisation

Need something even more custom? Get in touch via [email protected] to explore tailored solutions for your use case.


What’s Next