Skip to content

Instantly share code, notes, and snippets.

quickReplies.push({
"content_type": "text",
"title": "Next",
"payload": "nextslice_5_10"
});
@johnotu
johnotu / handle-messages.js
Created December 7, 2018 17:49
Payment for Messenger - Handle Bot Messages
/**
* Handle messages received by bot server
*
*/
'use strict';
// Assume you have these functions defined and exported in your project folder
const sendTextMessage = require('../actions/sendTextMsg');
const sendButtonMsg = require('../actions/sendButtonMsg');
@johnotu
johnotu / handle-postbacks.js
Created December 7, 2018 17:50
Payment for Messenger - Handle Bot Postbacks
/**
* Handle postbacks received by bot server
*
*/
'use strict';
// Assume you have these functions defined and exported in your project folder
const sendTextMessage = require('../actions/sendTextMsg');
const processMobilemoney = require('./process-mobilemoney-gh');
@johnotu
johnotu / process-mobilemoney-gh.js
Created December 7, 2018 17:52
Payment for Messenger - Process Mobilemoney payments
/**
* Process mobile money payments using Mazzuma API
*
*/
'use strict';
const request = require('request');
const sendTextMessage = require('../actions/sendTextMsg');
@johnotu
johnotu / process-cardpayment.js
Created December 7, 2018 18:43
Payment for Messenger - Process Card payments
/**
* Handle card payment using Flutterwave API
*
*/
'use strict';
const express = require('express');
const router = express.Router();
const request = require('request');
@johnotu
johnotu / payment-webview.ejs
Created December 7, 2018 18:44
Payment for Messenger - Payment Webview
<html lang="en">
<head>
<title>Card payment</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous"> >
<meta name="viewport" , content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<style>
@johnotu
johnotu / handle-messages.js
Created December 7, 2018 18:51
Code Snippets - Custom Payments for Messenger
/**
* Handle messages received by bot server
*
*/
'use strict';
// Assume you have these functions defined and exported in your project folder
const sendTextMessage = require('../actions/sendTextMsg');
const sendButtonMsg = require('../actions/sendButtonMsg');
@johnotu
johnotu / blog-app.js
Last active May 24, 2019 09:15
Initial parent component (before we add child components)
'use strict';
class BlogApp extends React.Component {
constructor(props) {
super(props);
this.state = {
blogPost: {}
};
}
@johnotu
johnotu / blog-app.js
Last active May 24, 2019 09:17
Putting it all together
'use strict';
const Header = props => {
return (
<header>
<nav className="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a className="navbar-brand" href="#">My Blog</a>
</nav>
</header>
)
@johnotu
johnotu / index.html
Created May 24, 2019 11:06
Basic HTML page with Bootstrap 4.0 including script tags for React and Babel
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"