@salesforce/afv-skills 1.53.0 → 1.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/service-agentforce-contact-center-coordinate/SKILL.md +170 -0
- package/skills/service-agentforce-contact-center-coordinate/assets/escalation-flow.flow-meta.xml +72 -0
- package/skills/service-agentforce-contact-center-coordinate/assets/omni-flow.flow-meta.xml +85 -0
- package/skills/service-agentforce-contact-center-coordinate/assets/report-template.md +52 -0
- package/skills/service-agentforce-contact-center-coordinate/references/agentforce-prerequisite.md +31 -0
- package/skills/service-agentforce-contact-center-coordinate/references/messaging_channel.md +76 -0
- package/skills/service-agentforce-contact-center-coordinate/references/number_management_api.md +78 -0
- package/skills/service-agentforce-contact-center-coordinate/references/omni-flow-routing.md +74 -0
- package/skills/service-agentforce-contact-center-coordinate/references/setup_summary.md +36 -0
- package/skills/service-agentforce-contact-center-coordinate/references/verification_and_errors.md +42 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/check-agentforce-prereq.sh +54 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/create-routing-flows.sh +49 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/create-voice-agent.sh +73 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/create-voice-channel.sh +66 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/fetch-numbers.sh +21 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/lib.sh +46 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/prepare-agent-workdir.sh +21 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/procure-number.sh +24 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/resolve-acc-queue.sh +27 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/resolve-channel-line.sh +37 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/resolve-flow-definition.sh +33 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/verify-number-live.sh +63 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Verify a procured number is live, reconciling state and polling if needed.
|
|
3
|
+
# Usage: verify-number-live.sh <org-alias> <phone-number>
|
|
4
|
+
# Output: final CodeStatus value on stdout. Exit 0 if Live, 2 on usage error, 3 if
|
|
5
|
+
# still not Live after polling, 4 if a status query or numberStateReconcile returned
|
|
6
|
+
# an API error (details printed to stderr).
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
10
|
+
source "$SCRIPT_DIR/lib.sh"
|
|
11
|
+
|
|
12
|
+
if [[ "${1:-}" == "--help" || $# -lt 2 ]]; then
|
|
13
|
+
echo "Usage: verify-number-live.sh <org-alias> <phone-number>" >&2
|
|
14
|
+
[[ "${1:-}" == "--help" ]] && exit 0 || exit 2
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
ALIAS="$1"; NUMBER="$2"
|
|
18
|
+
|
|
19
|
+
# CommunicationChannelLine is Tooling-API-only (not queryable via `sf data query`) and its
|
|
20
|
+
# live-status field is CodeStatus, not Status__c — query it the same way
|
|
21
|
+
# resolve-channel-line.sh does.
|
|
22
|
+
query_status() {
|
|
23
|
+
local encoded_phone="${NUMBER//+/%2B}"
|
|
24
|
+
local query="SELECT+CodeStatus+FROM+CommunicationChannelLine+WHERE+Code='${encoded_phone}'+LIMIT+1"
|
|
25
|
+
local resp
|
|
26
|
+
resp=$(sf api request rest \
|
|
27
|
+
"/services/data/${API_VERSION}/tooling/query?q=${query}" \
|
|
28
|
+
--target-org "$ALIAS" 2>/dev/null || true)
|
|
29
|
+
# A success query is an object; an API error is a JSON array [{errorCode,...}].
|
|
30
|
+
# Stop on the error shape instead of letting jq crash on `.records` below.
|
|
31
|
+
echo "$resp" | jq -e 'type == "array"' >/dev/null 2>&1 && { echo "error: status query failed for ${NUMBER}: $resp" >&2; exit 4; }
|
|
32
|
+
echo "$resp" | jq -r '.records[0].CodeStatus // empty'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
STATUS=$(query_status)
|
|
36
|
+
if [[ "$STATUS" == "Live" ]]; then
|
|
37
|
+
echo "Live"; exit 0
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# Reconcile, then poll every 5s up to 3 times.
|
|
41
|
+
# A non-2xx here (auth/API failure) must stop the workflow per the skill's
|
|
42
|
+
# stop-on-non-2xx rule — do NOT swallow it, or the script could create a channel
|
|
43
|
+
# on top of a failed reconciliation. Report the API error and exit.
|
|
44
|
+
RECONCILE_RESP=$(sf api request rest \
|
|
45
|
+
"/${NM_BASE}/numberStateReconcile" \
|
|
46
|
+
--method POST \
|
|
47
|
+
--body "$(jq -n --arg p "$NUMBER" '{phoneNumber:$p}')" \
|
|
48
|
+
--target-org "$ALIAS" 2>&1) || {
|
|
49
|
+
echo "numberStateReconcile failed:" >&2
|
|
50
|
+
echo "$RECONCILE_RESP" >&2
|
|
51
|
+
exit 4
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for attempt in 1 2 3; do
|
|
55
|
+
sleep 5
|
|
56
|
+
STATUS=$(query_status)
|
|
57
|
+
if [[ "$STATUS" == "Live" ]]; then
|
|
58
|
+
echo "Live"; exit 0
|
|
59
|
+
fi
|
|
60
|
+
done
|
|
61
|
+
|
|
62
|
+
echo "${STATUS:-Provisioning}"
|
|
63
|
+
exit 3
|