Integrations API - Getting Started

Edited

Once you've gone ahead and generated a JSON Web Token (JWT) as outlined in this article, you're now ready to begin exploring the Integrations API. Your Integrations API credentials are tied to your Jebbit account and all of the experiences you choose to build within that account. To view your currently authenticated Jebbit account, try the following request:

Example HTTP Request

GET /api/v1/self HTTP/1.1
Host: api.jebbx.com
Authorization: Bearer <YOUR JWT>

*Note: Example is using the staging endpoint. Please use the production endpoint.

Example Response

{
    "data": {
        "id": "bTUIhsye",
        "type": "businesses",
        "attributes": {
            "name": "Jebbit Internal"
        }
    }
}

We now know that the Jebbit Account ID that is tied to our API credentials is bTUIhsye. Next, let's go ahead and set up the webhook service so that you may begin receiving user session data. Below is an example request to create a webhook service:

Example Request

POST /api/v1/integrations HTTP/1.1
Host: api.jebbx.com
Content-Type: application/vnd.api+json
Authorization: Bearer <YOUR JWT>
Content-Length: 198

{"data": { "attributes": { "endpoint": "<YOUR ENDPOINT>", "region": "us", "additional_options": { "hash_pii": false}, "is_active" : true}, "type": "integrations"}}

Note:

1.) This is using the staging endpoint. Please use the production endpoint.

2.) Please insert the endpoint of the service receiving our webhook where it says <YOUR ENDPOINT>.

Example Response

{
    "data": {
        "id": "L5m24mjs",
        "type": "integrations",
        "attributes": {
            "endpoint": "<YOUR ENDPOINT>",
            "include_uids": false,
            "region": "us",
            "require_opt_in": null,
            "created_at": "2021-12-16T17:48:14.098Z",
            "updated_at": "2021-12-16T17:48:14.167Z",
            "service_name": "webhooks_standard",
            "include_mapped_attributes": true,
            "additional_options": {
                "hash_pii": false
            },
            "is_active": true,
            "shared_secret": "Qq6niUmvrO320lYbBGKha6cdy22Bz8BVBd"
        }
    }
}

The above response contains all the details about our newly created integration including its ID, type, and attributes. The shared_secret is one of the critical payload elements for you to retrieve as this is what will be used to authenticate and transmit data between our webhook and your receiving endpoint. After providing the endpoint system with the mutually shared_secret, you can send a test submission to validate it's working:

Example Request

POST /api/v1/integrations/L5m24mjs/test HTTP/1.1
Host: api.jebbx.com
Authorization: Bearer <YOUR JWT>
Content-Type: application/vnd.api+json
Content-Length: 2

{}

Example Response

["{\"data\":{\"email\":\"test@example.com\",\"test_attribute\":\"attribute_value\",\"test_sata_attribute\":[\"option 1\",\"option 4\"],\"opt_in\":\"true\",\"outcome\":\"example_outcome\"},\"event\":{\"event_number\":0}}"]