> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/push/templates/test-send.md).

# Send a test push

Send one push of a template to one user or one device from the template's Test panel.

**Where:** Push → Templates → a template → **Test** · `/projects/<project>/push/templates/<templateId>/edit`

## Before you start

* The template is saved and the form has no unsaved changes — **Test** is hidden otherwise.
* An enabled push integration. With the [Fake Push (Test Me)](/codemash/cloud/push/integrations/providers/fake.md) nothing reaches a device; with a real provider the test is a real notification.
* A recipient: a project user with a [registered device](/codemash/cloud/push/devices.md), or one registered device.

## Steps

1. Open the template, here `Password changed`, and press **Test**. The panel **Send Test Push** opens (*Send this template as a push notification to one device or one user.*).
2. Pick the **Select language** (the project default first) and the **Push Provider** (the default integration first).
3. In the **Test Tokens Panel**, keep **Trigger Type** on **Not a trigger** (or pick a trigger type to fill trigger tokens with sample data) and give every token under **Template Tokens** a value. A yellow box lists the tokens that still have none.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-f52f14d1155566d7b48305f5a7f587dec300f9ba%2Ftemplates-test-send-1.png?alt=media" alt="Send Test Push panel: Select language English, Push Provider Test Me (Fake), Test Tokens Panel with Trigger Type Not a trigger, the empty FirstName token and the box Pick a value for every token before sending. Still missing: @Model.FirstName (body)"><figcaption><p>The Test panel with a token still empty.</p></figcaption></figure>
4. Under **Send test push to:** choose the tab **User** and pick one in **Pick a user** (*The push reaches every device that user has registered.*), or the tab **Device** and pick one in **Pick a device**.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-961355445ae000bbb98ddaeb1e10ccc0c13ffe45%2Ftemplates-test-send-2.png?alt=media" alt="The Test panel with FirstName Ada, the User tab and ada.lovelace@example.com picked, and the Cancel and Send Test Push buttons"><figcaption><p>Ready to send to one user.</p></figcaption></figure>

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-c89c38e6152f5bdf1a4e8f19a0ab2083626b36c1%2Ftemplates-test-send-4.png?alt=media" alt="The Device tab of Send test push to: with the Pick a device field"><figcaption><p>The Device tab.</p></figcaption></figure>
5. Press **Send Test Push**.

## Result

A green box says *Test push sent. See campaigns for the delivery result.* The test is a real one-recipient campaign: it appears in [Campaigns](/codemash/cloud/push/campaigns.md) (**Specified users** or **Specific devices**) and moves to **Completed**. The panel stays open for another test.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-be41eca3ad7aeb7eab4fbdf2195a8a56f673b209%2Ftemplates-test-send-3.png?alt=media" alt="Success! Test push sent. See campaigns for the delivery result. above the Send Test Push panel"><figcaption><p>The test was sent.</p></figcaption></figure>

## Change or remove it later

* A test cannot be undone. Delete its campaign on the [campaign details page](/codemash/cloud/push/campaigns/details.md#change-or-remove-it-later) if you do not want it in the list.

## Do it from code

A test is a campaign to one user or one device. A device needs its platform (`Ios`, `Android`, `Chrome`, `Safari`).

```ts
const { id } = await norbix.hub.notifications.createPushCampaign({
  campaign: {
    source: 'Devices',
    templateId: 'tmpl_5IStKcssvWDLtEJLJdFKvJ', // Weekend sale
    integrationId: 'int_5w5gi8BSgF9H7E76Ud6K7F', // Test Me (Fake)
    devices: [{ token: 'b3f1c9d2e8a7465f9c0d1e2f3a4b5c6d7e8f90a1b2c3d4e5f6a7b8c9d0e1f2a3', deliveryFamily: 'Ios' }],
  },
});
console.log(id); // cmp_5Gss9JG8XXgGc0v9PIAgRd
```

```sh
norbix hub notifications push campaign create --campaign '{"source":"Devices","templateId":"tmpl_5IStKcssvWDLtEJLJdFKvJ","integrationId":"int_5w5gi8BSgF9H7E76Ud6K7F","devices":[{"token":"fK3pZ8qLR0e1:APA91bH7xQ2vN5mT8wY1cE4rU6iO9pA3sD5fG7hJ9kL1zX3cV5bN7mQ9wE2rT4yU6iO8pA0sD2fG4hJ6kL8zX0cV2bN4mQ6w","deliveryFamily":"Android"}]}'
```

The client setup is on the [Push page](/codemash/cloud/push.md#use-it-from-code). API: [Create Push Campaign](/codemash/api-reference/notifications/push/create-push-campaign.md) · [Render Push](/codemash/api-reference/notifications/push/render-push.md) (the text with the tokens filled, as the panel shows it)
