gupshup

Callback URL invalid when trying to link my bot on Gupshup


I am trying to link my bot with Gupshup platform. I get an error saying my callback url (ngrok) is not valid even though the URL is valid and I can test the response on my browser. Has anyone experienced similar issues?


Solution

  • When you try to link your bot using a callback URL, Gupshup makes a Get call to the URL provided along with these dummy URL parameters

    channel=telegram&contextobj={"botname":"demobot1","channeltype":"telegram","contextid":"164772271","contexttype":"p2p"}&senderobj={"channelid":"164772271","channeltype":"telegram","display":"Test"}&messageobj={"text":"hi","type":"msg"}&botname=<yourbotname>
    

    Your bot code should respond back with a 200 ok response for Gupshup to accept it as a valid callback URL.

    For example:

    If you are developing in Java and have project called testbot which contains a servelet like @WebServlet("/botcode") then your callback URL with ngork should be:

    <ngrok https url>/testbot/botcode
    

    Sample URL:

    https://fa3119a4.ngrok.io/testbot/botcode