This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet"> | |
<script type="text/javascript" src="//dl.frontapp.com/libs/plugin-sdk-1.0.1.min.js"></script> | |
<title>Front Plugin v1</title> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require './../vendor/autoload.php'; | |
use GuzzleHttp\Client; | |
$client = new Client([ | |
'base_uri' => 'https://api2.frontapp.com/', | |
'headers' => [ | |
'Authorization' => 'Bearer [FRONT_API_TOKEN]', | |
'Content-Type' => 'multipart/form-data', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Overview | |
This example shows us how to create a conversation in Front using the Receive custom messages | |
endpoint (https://dev.frontapp.com/reference/messages-1#post_channels-channel-id-incoming-messages), | |
then apply a tag to that newly created conversation based on the message_uid attribute returned | |
from that API call. | |
## Implementation | |
1. Create the inbound message, using the "Receive Custom Messages" endpoint - https://dev.frontapp.com/reference/messages-1#post_channels-channel-id-incoming-messages | |
2. Grab the `message_uid` from that response | |
3. Use Resource aliases ( https://dev.frontapp.com/reference/introduction#resource-aliases ) with the `GET /messages` endpoint to fetch the message by UID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="app"> | |
<head> | |
<title>Front Plugin</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script type="text/javascript" src="//dl.frontapp.com/libs/plugin-sdk-1.0.1.min.js"></script> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# place this after nvm initialization! | |
# Inspired by https://github.com/nvm-sh/nvm#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file | |
autoload -U add-zsh-hook | |
load-nvmrc() { | |
local nvmrc_path="$(nvm_find_nvmrc)" | |
if [ -e "$nvmrc_path" ]; then | |
local node_version="$(nvm version)" | |
if [ -n "$nvmrc_path" ]; then | |
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const FRONT_API_TOKEN = 'YOUR FRONT API TOKEN GOES HERE'; | |
const CHANNEL_ID = 'YOUR FRONT CHANNEL ID GOES HERE'; | |
const FormData = require('form-data'); | |
const fs = require('fs'); | |
// abstract and promisify actual network request | |
async function makeRequest(formData, options) { | |
return new Promise((resolve, reject) => { | |
const req = formData.submit(options, (err, res) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="app"> | |
<head> | |
<title>Basic Front Plugin</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script type="text/javascript" src="//dl.frontapp.com/libs/plugin-sdk-1.0.1.min.js"></script> | |
<script type="text/javascript"> | |
Front.contextUpdates.subscribe(context => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userHash = OpenSSL::HMAC.hexdigest("SHA256", ENV['FRONTAPP_VERIFICATION_KEY'], email) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$userHash = hash_hmac('sha256', $userEmail, $verificationSecret); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'openssl' | |
require 'Base64' | |
SECRET_KEY = "your-secret-key" | |
post '/payload' do | |
payload = request.body.read | |