Publish Your Bot on PubNub
Get callback URL and sample code
- Log in to the Gupshup website
- Go to the Dashboard tab > My Bots section.
- Select the Channel button under the Publish column against the bot you wish to publish.
- A list of channels will appear. Click on the Publish button against PubNub.
- Scroll down and click Setup PubNub function to call Gupshup bot using XHR module.
- Copy the Callback URL and sample code for later use.
Create a PubNub function
- Log in to your PubNub account. Sign up if you don't have a PubNub account.
- Navigate to the Functions tab in the sidebar.
- Click on the All apps drop-down menu and select My First App.
- Click on the + CREATE NEW MODULE button.
- Provide the module name, and module description and select the keyset from the drop-down menu. Click Create.
- Click and open the function module you just created.
- Click on the + CREATE NEW FUNCTION button.
- Provide a function and select the event type as After Publish or Fire from the drop-down menu.
- A new field titled Channel name will appear. Enter the channel name starting with Gupshup. For example: Gupshup.demo.
- Click the Create button.
Configure the PubNub function to call the Gupshup bot
- Use the callback URL and sample code copied earlier from the Gupshup website to set up the PubNub function to call the bot using the XHR module.
- Click on the Save button present in the left sidebar.
Get Publish Key and Subscribe Key from PubNub
- Go to the Home page of your PubNub account.
- Go to Keysets in the sidebar.
- Click on All Apps and select the App in which you created the function.
- Copy the PUBLISH KEY and SUBSCRIBE KEY for later use.
Submit credentials
- Log in to the Gupshup website.
- Go to the Dashboard tab > My Bots section.
- Select the Channel button under the Publish column against the bot you wish to publish.
- A list of channels will appear. Click on the Publish button against PubNub.
- Scroll down and click Submit Publish Key and Subscribe Key to publish your bot.
- Enter the Publish key and Subscribe key copied earlier from the PubNub website.
Updated over 1 year ago