The application show how to set up subscriptions for Santa Delivery Notifications. The user initally subscribes for notifications and later gets notifications when Santa has delivered presents to their locations. Notifications are sent via Facebook Messenger with fallback to SMS when the Facebook message is not read. Messaging is achived using the Nexmo Dispatch API.
Prerequisites
Contains privatekey and publickey. You use the private key to generate the JWTs used to authenticate your calls to the Nexmo APIs. The public key is used by Nexmo to authenticate the JWT in your requests to Nexmo API.
Aug 25, 2016 nexmo jwt:generate keyfilepath applicationid=abcd1234 subject=tjlytle acl='complexvalue, withspaces, andcommas' This was referenced Oct 6, 2016 Add a way to generate a JWT with a custom key, app ID and additional claims Nexmo/nexmo-node#69. Messaging is achived using the Nexmo Dispatch API. A Nexmo account; An mLab account; A Facebook account; Install the Nexmo CLI used during the setup documented here; An Ngrok account for testing the application locally; Setup Local application environment. Clone this repo. Install dependencies and create a.env file.
SetupLocal application environment
Clone this repo.
Install dependencies and create a
.env file.
Get Ngrok running locally and tunnelling do port
1234 for the locally running application.
Create a Nexmo application:
You can read more on this in the How to create a Nexmo Messages and Dispatch Application documentation.
Update the contents of
.env with the required configuration values.
Note: there are still some configuration values that will be required to be added once the Facebook setup steps are completed.
Run the application:
![]() Facebook Page and App
Create a Facebook page:
Create a Facebook application associated with the Facebook page.
Set up the Facebook webhook with your Ngrok URL from earlier. When 'Verify and Save' is clicked your webhook URL will be called. Note the code for echoing back the
hub.challenge value is in place so the saving should complete.
Configure Facebook webhook events:
Link Facebook Page to NexmoApp Jwt Nexmo Jwt Generate Private.key Application_id Your_app_id Account
Generate a JWT for your Nexmo Application. Replace
YOUR_APP_ID with your Nexmo Application ID:
Link the Nexmo application with your Facebook page using the Nexmo Facebook app linking page.
App Jwt Nexmo Jwt Generate Private.key Application_id Your_app_id FreeLicenseApp Jwt Nexmo Jwt Generate Private.key Application_id Your_app_id Number
MIT
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |