0
我有這個PHP webhook頁面,我正在使用我的示例smooch.io應用程序,請參閱下文。示例Smooch.io PHP webhook
<?php
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if (!$update) {
// receive wrong update, must not happen
exit;
}
logf(json_encode($content));
/*curl https://api.smooch.io/v1/appusers/5790bff5237cbc5d00b10a17/conversation/messages \
-X POST \
-d '{"text":"Just put some vinegar on it", "role": "appMaker"}' \
-H 'content-type: application/json' \
-H 'authorization: Bearer your-jwt'
*/
$parameters["text"] = "Reply from the webhook!";
$parameters["role"] = "appMaker";
$handle = curl_init("https://api.smooch.io/v1/appusers/5790bff5237cbc5d00b10a17/conversation/messages");
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($handle, CURLOPT_TIMEOUT, 60);
curl_setopt($handle, CURLOPT_POSTFIELDS, json_encode($parameters));
curl_setopt($handle, CURLOPT_HTTPHEADER,
array("Content-Type: application/json; charset=utf-8","Authorization: Bearer ".MY_JWT)
);
$response = curl_exec($handle);
logf("response: ".$response);
$response = json_decode($response, true);
function logf($str){
$logf = "smooch.txt";
$dtnow = date("dmy H:i:s");
$logfh = fopen($logf, 'a');
$str = $dtnow." - ".$str."\n";
fputs($logfh, $str);
fclose($logfh);
}
我收到以下錯誤在我登錄響應
響應:{ 「錯誤」:{ 「代碼」: 「user_not_found」, 「說明」: 「用戶未找到」}}
我在這裏驗證了我的簽名使用我懷疑從smooch.io
給出的憑證https://jwt.io/它的這個{smoochId |用戶id}值?我從瀏覽器的URL中複製了這些隨機字符(5790bff5237cbc5d00b10a17),我假設這是我的用戶ID。請告訴我如何獲得我的smoochID或userID。謝謝!