https://github.com/hostari/bentonow_client
A crystal lang wrapper for the Bentonow API.
https://github.com/hostari/bentonow_client
bento crystal
Last synced: 2 months ago
JSON representation
A crystal lang wrapper for the Bentonow API.
- Host: GitHub
- URL: https://github.com/hostari/bentonow_client
- Owner: hostari
- License: mit
- Created: 2022-06-20T09:11:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-31T22:58:13.000Z (12 months ago)
- Last Synced: 2025-01-24T22:41:24.632Z (4 months ago)
- Topics: bento, crystal
- Language: Crystal
- Homepage: https://hostari.github.io/bentonow_client/
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bentonow_client
A crystal lang wrapper for the [Bentonow API](https://bentonow.com/).
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
bentonow_client:
github: hostari/bentonow_client
```2. Run `shards install`
## Usage
Set the following api keys in `.env`: `publishable_key`, `secret_key`, `site_uuid`.
```crystal
require "bentonow_client"
```To build a new Bentonow client:
```crystal
publishable_key = ENV["BENTO_PUBLISHABLE_KEY"]
secret_key = ENV["BENTO_SECRET_KEY"]
client = Bentonow::Client.new(publishable_key, secret_key)
```## Endpoints
Most useful available Bentonow API resources are implemented.1. [Creating an Event](https://docs.bentonow.com/reference-api/create-events) - for single or batch processing of events such as adding users and other user information, adding tags to already exisiting users, or adding fields to existing users.
```crystal
body = {
events: [
{
type: "$completed_onboarding",
email: "[email protected]"
},
{
type: "$completed_onboarding",
email: "[email protected]",
fields: {
first_name: "Jesse",
last_name: "Pinkman"
}
},
{
email: "[email protected]",
type: "$purchase",
fields: {
first_name: "Jesse"
},
details: {
unique: {
key: "test123"
},
value: {
currency: "USD",
amount: 8000
},
cart: {
items: [
{
product_sku: "SKU123",
product_name: "Test",
quantity: 100
}
],
abandoned_checkout_url: "https://test.com"
}
}
}
]
}.to_json
site_uuid = ENV["BENTO_SITE_UUID"]
event = Bentonow::Event.create_event(publishable_key, secret_key, site_uuid, body)
```## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Contributors
- [Pauline De Polonia](https://github.com/paula4230) - creator
- [Xavi Ablaza](https://github.com/xaviablaza) - maintainer