> ## Documentation Index
> Fetch the complete documentation index at: https://help.smile.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Digioh integration setup

> Setup instructions for installing and configuring the Smile and Digioh integration.

## How it works

When a customer completes a Digioh form, Digioh will automatically send a request to Smile's API to create an activity record. Smile will then evaluate the activity against your program configuration and issue points to the customer if they qualify. This enables you to reward customers for completing Digioh forms without any custom code required.

## 1. Create a custom activity type

First, define the action you want to reward for in Smile.

1. In **Smile Admin**, navigate to **Settings** > [**Developer tools**](https://app.smile.io/settings/developer-tools).
2. In the **Custom activities** card, click **Create new activity type**.
3. Fill in the **Name before completed** (e.g. *"Complete our product quiz"*) and **Name after completed** (e.g. *"Completed our product quiz"*) fields.
4. Optionally, check **Include a call to action** and add a link to the Digioh experience so customers can find it directly from all Smile surfaces (e.g. the rewards panel, Loyalty Hub, etc).
5. Click **Create**.
6. Copy the **Token** (e.g. `activity_abc123...`) to a safe place — you'll need it in Step 4.

<Warning>
  **Warning:** Including a call to action does NOT automatically trigger a reward when the link is clicked. You must still complete the remaining steps to notify Smile when the Digioh form is submitted.
</Warning>

## 2. Create a way to earn

Next, configure how many points customers earn when the form is submitted.

1. In **Smile Admin**, navigate to **Program** > [**Points**](https://app.smile.io/reward-programs/points).
2. Click **Add ways to earn**.
3. Select the custom activity type you created in Step 1.
4. In the **Earning value** card, enter the number of points to award.
5. Click **Create**.

Once active, this way to earn will appear in all Smile surfaces and be visible to customers.

## 3. Create a Smile API key

Then, create a Smile API key with permissions to create activities.

1. In **Smile Admin**, navigate to **Settings** > **[Developer tools](https://app.smile.io/settings/developer-tools)**.
2. In the **Manage API keys** card, click **Generate new API key**.
3. In the **Name** field, enter `Digioh`.
4. For access scopes, select only `Create and manage customer activities [activity:write]`
5. Click **Generate**.
6. Copy the **API key** (e.g. `api_abc123...`) to a safe place — you'll need it in Step 4.

## 4. Set up a Digioh API Form Post

Finally, configure Digioh to notify Smile whenever a customer submits your form.

### Create the integration

1. In your **Digioh account**, navigate to **Integrations** > **[Add New Integration](https://account.digioh.com/Integration/Create?Partner_B=custom)**.

2. Set the **Friendly Name** to `Create Smile.io Activity`.

3. For **Integration**, ensure **API Form Post** is selected.

4. Set the **Form Post URL** to:

   ```
   https://api.smile.io/v1/activities
   ```

5. Set the **Post Type** to **JSON Raw**.

6. From the **Campaign** dropdown, select the campaign/form you want to reward for the completion of.

7. Click **Create Integration**.

<Info>
  **Important:** Once created, you'll be taken to the **Integration Advanced Settings** screen. You must follow the instructions below to finish configuring the integration.
</Info>

### Configure advanced settings

From the **Integration Advanced Settings** screen:

1. Confirm the **HTTP Method** is set to **POST**.

2. In the **Header Key 1** field, enter:

   ```
   Authorization
   ```

3. In the **Header Value 1** field, enter the following — replacing `YOUR_SMILE_API_KEY` with the API key you created in Step 3:

   ```
   Bearer YOUR_SMILE_API_KEY
   ```

4. In the **Integration Template** field, paste the following JSON — replacing `YOUR_ACTIVITY_TOKEN` with the token from Step 1:

   ```json theme={null}
   {
     "activity": {
       "customer_email": "[EMAIL]",
       "token": "YOUR_ACTIVITY_TOKEN",
       "distinct_id": "[SUBMISSION_ID]",
       "created_on_origin_at": "[SUBMIT_DATE]"
     }
   }
   ```

   <Info>
     **Important:** Digioh uses uppercase square-bracket syntax (e.g. `[EMAIL]`) to insert form values into the template. The JSON must be valid — avoid trailing commas or unsupported merge tags, as these will cause the request to fail.
   </Info>

5. Click **Save Advanced Settings**.

## 5. Test the integration

1. Submit your Digioh form using an email address associated with a customer in your Smile program.
2. In your Digioh account, navigate to **Integrations**, click **View Logs** and confirm the request returned a successful response (the response body should include an `activity` object with an `id`).
3. In **Smile Admin**, look up the customer and confirm their points balance has been updated.

<Note>
  **Note:** After a successful activity is created, Smile evaluates it against your program configuration asynchronously. Points are typically issued within a few seconds, but may take slightly longer during high traffic periods.
</Note>

## Troubleshooting

| Issue                                          | What to check                                                                                                                                    |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Request fails with `500 Internal Server Error` | Confirm `customer_email` is resolving to a non-empty value. Check the Digioh Integration Log Stream to see the exact request that was sent.      |
| Request fails with a JSON parse error          | Check your Integration Template for invalid JSON — common causes include trailing commas or merge tags that couldn't be resolved.                |
| Customer is not receiving points               | Confirm the way to earn from Step 2 is active, and that the `token` in your template matches the activity type created in Step 1.                |
| Duplicate points on resubmission               | Ensure `[SUBMISSION_ID]` is included in your template as the `distinct_id`. This prevents the same submission from being counted more than once. |
