How to use single user notifications?

More often than not, notifications that are custom crafted for each one of your users will get a much higher engagement. So whether you are sending out custom crafted offers to your users, or you want to build your own user notification center without hassle, single user notifications will be your best bet.

So, how can you use Beamer to send out single user notifications? It’s actually pretty simple:

1) Fill in the user_id parameter in your embed script.

While the rest of the parameters containing your user’s personal information (such as user_firstname and user_lastname) remain optional, the only parameter that’s required for single user notifications to work is the user_id.

This is simply a string meant to represent your own user’s unique ID. This parameter can have any format whatsoever, as long as you make sure it is an unique identifier for each of your users.

Here’s an example of how the embed script could look for a user that’s logged into your platform:

	var beamer_config = {
		product_id : 'your-product-id',
		button_position : 'bottom-right',
		user_firstname : 'John',
		user_lastname : 'Doe',
		user_email : '',
		user_id : '1234'// This should be your app's user ID
<script type="text/javascript" src="" defer="defer"></script>

Great! Now your user will be correctly identified by Beamer. All the user info (it’s ID and all the other fields, if completed) will now show up in your Analytics section so you can see which posts your user has viewed or clicked on, and any of it’s feedbacks and reactions.

Let’s now send a notification that will be visible only to this user.


2) Make use of the API to create the notification.

To create notifications in Beamer, you can make use of the /posts endpoint in our API. A POST request to this endpoint will create a notification in the account you are authenticating the request with.

First, we’ll create a JSON object with some example content and an image for the notification:

In this step, it’s crucial to make use of filterUserId as described in the API docs. This parameter is matched against the user_id parameter of the embed script. As you would expect, this will create a notification visible only to the user with id ‘1234’.

Now, we’ll send this JSON to the /posts endpoint of the API (we’ll use curl in this example):

It’s important that all requests to the API include your API key in the Beamer-Api-Key header, as unauthenticated requests will be rejected.

Since we didn’t schedule this post to be published in a future date, it should be published immediately! If push notifications are enabled in the account, the example user should receive one now.

When opening Beamer in your site, that post should now be visible as well:

So that’s it! You’ve just sent a single user notification.

Quick recap: Make sure you pass in the user_id parameter to the embed script in your site, and then the filterUserId parameter when creating a post through the API. What’s inside the notification is up to you!