How to publish a bot on PubNub

Get callback URL and sample code

  • Log in to the Gupshup website.
  • Go to Dashboard tab > My Bots section.
  • Select the 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.
18681868

Create a PubNub function

  • Log in to your PubNub account. Sign up if you don't have a PubNub account.
  • Go to Functions in the sidebar.
19201920
  • Enter a new module name and description.
  • Click on the Create New Module + button.
19201920
  • Click on the + Create Function button.
  • Enter a new function and select event type as After Publish or Fire from the drop-down menu.
  • A new field titled "Channel Name" appears. Enter the channel name starting with "gupshup.". For example: "gupshup.demochannel"
  • Click the Create button.
958958

Configure the PubNub function to call 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 XHR module.
  • Click the Save button.
19201920

Get Publish Key and Subscribe Key from PubNub

  • Go 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.
18941894

Submit credentials

  • Log in to the Gupshup website.
  • Go to Dashboard tab > My Bots section.
  • Select the 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 required information copied earlier from the PubNub website.
747747

Did this page help you?