Setup Instructions for API Integration

Getting Started
Posted by
Trevor Paesl

Integrating Snappysas into your application using the API gives you the greatest flexability. Just follow these easy steps:

Obtain Your API Key

Your API key uniquely indentifies your account and application.

  1. Log into your Snappysas account. You can create one for free if you don't have one already.
  2. Using the menu, go to 'Account', and then 'API Keys'.
  3. Copy your API key from this page and save it for later; you'll need it in a few minutes. The key is 36 characters long and contains letters, numbers, and dashes.

Integrate Snappysas Into Your App's Code

There are three pieces of functionality that you'll need to implement in your application in order to allow Snappysas to deliver in-app messages inside of your app. This includes displaying messages to users, allowing users to dismiss messages, and allowing users to like messages.

Display Messages to Users

To obtain messages, make the following request in your application:

POST https://api.snappysas.com/messagefeed/messages/feed

Your request should include the following header (be sure to replace the [[API-KEY-PLACEHOLDER]] placeholder with the API key you previously obtained):

Authorization: [[API-KEY-PLACEHOLDER]]

Your request will also need to include the following JSON body:

{
   'id': '[[USER-ID-PLACEHOLDER]]',
   'name': '[[NAME-PLACEHOLDER]]',
   'user-time': '[[USER-TIME-PLACEHOLDER]]'
}
After including the default body above, you will need to set up user attributes. These user attributes should be dynamically populated for each user who uses your application. They provide context about the user, which will eventually be used for your targeted messaging campaigns.

  1. Replace the [[USER-ID-PLACEHOLDER]] placeholder with an ID that will uniquely identify the current user. This ID must remain the same forever and no two users can have the same ID. SECURITY TIP: read the best practices security considerations to select a safe ID.
  2. Replace the [[NAME-PLACEHOLDER]] placeholder with the user's real name. This field is not required, but is highly recommended (you should remove the attribute if you choose not to use it).
  3. Replace the [[USER-TIME-PLACEHOLDER]] placeholder with the user's local time. This field is not required, but is highly recommended (you should remove the attribute if you choose not to use it).
  4. Add additional attributes to the request body which provide additional context for your campaign targeting purposes. TIP: check out the best practices for choosing the right attributes.

Allow Users to Dismiss Messages

To allow a user to like a message, submit the following request after replacing the [[MESSAGE-ID]] placeholder:

POST https://api.snappysas.com/messagefeed/messages/dismiss/[[MESSAGE-ID]]

Your request should include the following header (be sure to replace the [[API-KEY-PLACEHOLDER]] placeholder with the API key you previously obtained):

Authorization: [[API-KEY-PLACEHOLDER]]

Allow Users to Like Messages

To allow a user to like a message, submit the following request after replacing the [[MESSAGE-ID]] placeholder:

POST https://api.snappysas.com/messagefeed/messages/like/[[message_ID]]

To unlike the message, submit the following request after replacing the [[MESSAGE-ID]] placeholder:

POST https://api.snappysas.com/messagefeed/messages/unlike/[[MESSAGE-ID]]

Both requests should include the following header (be sure to replace the [[API-KEY-PLACEHOLDER]] placeholder with the API key you previously obtained):

Authorization: [[API-KEY-PLACEHOLDER]]

Support Articles

Getting Started