November 17, 2015
This post is part 2 in an engineering blog series about building on top of the Mixmax SDK. See part 1 here.
Let's walk through step-by-step how to build a new
/giphycats command using the Mixmax SDK. This command is a spin on the built-in
/giphy command that appends the word "cat" to Giphy searches. After all, your email needs more cats.
git clone https://github.com/mixmaxhq/giphy-example-slash-command
npm installand then
npm start. You shouldn't see any errors and it should say
[nodemon] starting `node server.js`
|Typeahead API URL||https://localhost:9145/typeahead|
|Resolver API URL||https://localhost:9145/resolver|
Now refresh Gmail and you should be able to type
/giphycats in a new Mixmax window:
However, this command isn't living up to its name - it needs cats! Let's fix that. Open up the file
api/typeahead.js and replace the line
q: term, with
q: term + ' cats',. Now all search terms will be automatically appended with the word cats. Now try:
Much better! Now you have more cats in your email. Feel free to explore around and implement a Slash Command of your own.
/kb <search term>to bring up a list of knowledgebase articles to insert a link to in the email
/yourbrand <search term>to share a link with their friends