Third Party Apps
Hot to Integrate my Aplication to Snack Prompt
In order for your platform to be able to provide Snack Prompt information and features to your users, you will need to generate an API Key. Find out how to do this for your users quickly and easily below.
Step 1: Initiate Authentication
- Redirect your users to our authentication URL:
https://snackprompt.com/auth/plugin?plugin_name=YOUR_PLUGIN_NAME
Replace
YOUR PLUGIN_NAMEwith a codename that identifies your platform, use only lowercase letters and separated by dashes (kebab-case),
- Once the user reaches the platform, he must follow the Sncak Prompt login flow.
Step 2: API Key Generation
After successful authentication:
- Our system automatically generates a unique API Key for the user.
- The API Key is sent back to your application using
window.postMessage().
Step 3: Capture and Use the API Key
- In your application, implement a listener to capture the API Key:
// JavaScript sample
window.addEventListener('message', (event) => {
// Verify the origin for security
if (event.origin === 'https://snackprompt.com') {
const { apiKey } = event.data;
// Store the API Key securely
// Use it for subsequent API calls
}
});
- Now, your application already has the token needed to connect to all Snack Prompt features.
important
Always store and handle the API Key securely. Never expose it in client-side code or public repositories.