Skip to content

Commit

Permalink
Merge pull request #1813 from Heinivb/master
Browse files Browse the repository at this point in the history
Added replacablevar for a truncated msg. Dialogflow does not support messages longer than 256 chars, this is for those using Dialogflow with rest_api to just truncate the message
  • Loading branch information
remdex authored Dec 1, 2022
2 parents 8790be3 + 4b55a6f commit 3517cc5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,10 @@ public static function makeRequest($host, $methodSettings, $paramsCustomer)
$msg_text_cleaned = '';
}
}

$replaceVariables = array(
'{{msg}}' => $msg_text,
'{{msg_shortened_256}}' => substr($msg_text,0,254),
'{{msg_lowercase}}' => mb_strtolower($msg_text),
'{{msg_clean}}' => trim($msg_text_cleaned),
'{{msg_clean_lowercase}}' => mb_strtolower(trim($msg_text_cleaned)),
Expand Down Expand Up @@ -521,6 +522,7 @@ public static function makeRequest($host, $methodSettings, $paramsCustomer)

$replaceVariablesJSON = array(
'{{msg}}' => json_encode($msg_text),
'{{msg_shortened_256}}' => json_encode(substr($msg_text,0,254)),
'{{msg_lowercase}}' => json_encode(mb_strtolower($msg_text)),
'{{msg_clean}}' => json_encode(trim($msg_text_cleaned)),
'{{msg_clean_lowercase}}' => json_encode(mb_strtolower(trim($msg_text_cleaned))),
Expand Down

0 comments on commit 3517cc5

Please sign in to comment.