0

私は Gupshup を使用しており、チャットにサブビューを追加したいと考えています。これを行うには、次の変数を作成します。

var url="https://api.gupshup.io/sm/api/facebook/smartmsg/form/create";
var header = {"apikey":"xxxxxxxxxxxxxxxxxxx","Content-Type": "application/x-www-form-urlencoded","Accept":"application/json"};
var param={"formJSON":{
    "title": "This is a test.",
    "autoClose": false,
    "message": "Thank You",
    "callback-url": "https://www.gupshup.io/developer/bot/Cotizador/public",
    "fields": [{
        "type": "fbid",
        "name": "fbname",
        "label": "fbName"
    }, {
        "type": "input",
        "name": "name",
        "label": "Name",
        "validations": [{
            "regex": "^[A-Z a-z]+$",
            "msg": "Only alphabets are allowed in this field"
        }, {
            "regex": "^[A-Z a-z]{6,}$",
            "msg": "Minimum 6 characters required"
        }]
    }, {
        "type": "radio",
        "name": "gender",
        "label": "Gender",
        "options": [
            "Male",
            "Female"
        ],
        "validations": [{
            "regex": "",
            "msg": ""
        }]
    }, {
        "type": "select",
        "name": "account",
        "label": "AccountType",
        "options": [
            "current",
            "savings"
        ],
        "validations": [{
            "regex": "",
            "msg": ""
        }]
    }, {
        "type": "checkbox",
        "name": "interest",
        "label": "Interests",
        "options": [
            "Cooking",
            "Reading"
        ],
        "validations": [{
            "regex": "",
            "msg": ""
        }]
    }],
    "users": [
        "Testing"
    ]
}}

そして、次のように投稿を呼び出します。

context.simplehttp.makePost(url,JSON.stringify(param),header,parser);

そして私のコールバック

function parser(context, event) {
     context.console.log("Handler https")
           var result= JSON.parse(event.getresp);
        if(result=="success"){
       context.sendResponse("We have successfully stored your data");
       }else{
              context.sendResponse("We dont shoot");
       }
}

ただし、リクエストを投稿しても、チャットまたはコールバックで応答が表示されない場合。何が間違っているのですか?

4

1 に答える 1