This guide and the voucher API snippet provide you with a functioning solution for creating vouchers and sending them to your customers. You can also use this as inspiration for building your own workflows.
The workflow consists of three parts, from top to bottom; Voucher creation (trigger1), voucher verification (trigger2), and voucher redemption (trigger3).
Using the workflow
You need to call the workflow and specify which trigger you want to run depending on which part of the workflow you want to run. Our example API calls can be found in this chapter.
All calls use the same method and headers, found below.
[POST] https://rest.bosbec.io/2/workflows Headers Content-Type: application/json api-key: 00000000-0000-0000-0000-000000000000
Create voucher
The API call below will create a voucher with specified amount and customer email address. The response will contain the newly created voucher code.
{ "WorkflowId" : "00000000-0000-0000-0000-000000000000", "TriggerNames": "create", "MetaData": { "amount": "500", "customer_email": "johndoe@domain.com" }, "RequestSettings" : { "content-type":"json", "ResponseData" : { "code" : "metadata.code" } } }
Verify voucher
The following API call can be used to verify that a voucher code is valid. If valid, the response will contain the current remaining amount and the email that was registered.
{ "WorkflowId" : "00000000-0000-0000-0000-000000000000", "TriggerNames": "verify", "MetaData": { "code": "ABCDEF01234" }, "RequestSettings" : { "content-type":"json", "ResponseData" : { "code" : "metadata.code", "valid" : "metadata.valid", "current_amount" : "metadata.current_amount", "email" : "metadata.customer_email" } } }
Use voucher
The API call below subtracts the specified amount from the voucher code and returns the updated information in the response.
If the amount used exceeds the remaining value on the voucher, “actual usage” will show how much was available. The voucher will then be removed and can no longer be used.
{ "WorkflowId" : "00000000-0000-0000-0000-000000000000", "TriggerNames": "use", "MetaData": { "code": " ABCDEF01234", "use_amount" : "123" }, "RequestSettings" : { "content-gtype":"json", "ResponseData" : { "code" : "metadata.code", "valid" : "metadata.valid", "original_amount" : "metadata.original_amount", "previous_amount" : "metadata.previous_amount", "use_amount" : "metadata.use_amount", "actual_usage" : "metadata.actual_usage", "new_current_amount" : "metadata.new_current_amount", "email" : "metadata.customerg_email" } } }
Example of a response
You’ll find an example of a response from the “use voucher” call below.
{ "data": { "code": "ABCDEF01234", "valid": "true", "original_amount": "500", "previous_amount": "200", "use_amount": "300", "actual_usage": "200", "new_current_amount": "-100", "email": "johndoe@domain.com" }, "processId": "00000000-0000-0000-0000-000000000000", "executionTime": 261 }
Configuring the workflow
One of the biggest reasons to use the workflow builder for your IT solutions is that it gives you the ability to easily modify the workflow as needs and requirements change. This chapter will provide some pointers to where you can make changes to the workflow.
Change sender address
The email is set to be sent from noreply@bosbec.com by default. You can change this to your company email address instead.
- Open a message template’s properties by double clicking or selecting it and clicking the cog wheel.
- Scroll down to the input field “From”.
- Replace the email address with your own.
- Close the properties window.
- Save the workflow.
- Repeat for the other two message templates.
Change currency in the message text
The default message text is set to specify the amount in Euro (€). This is easily changed by following the steps below.
- Open a message template’s properties by double clicking or selecting it and clicking the cog wheel.
- Scroll down to the text area “Body”.
- Change the Euro sign to whichever currency you’d prefer.
- Close the properties window.
- Save the workflow.
- Repeat for the other two message templates.
If you need any assistance, we would be happy to help! Please reach out to us at support@bosbec.com if you have any questions about the Bosbec WE platform!
Get started by signing up for a free account today!
Sign up