token
This commit is contained in:
parent
9dbda69db1
commit
a2b076e9a1
6 changed files with 122 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ export function WhatsAppTokenPage() {
|
|||
const [token, setToken] = useState('')
|
||||
const [wabaId, setWabaId] = useState('')
|
||||
const [phoneNumberId, setPhoneNumberId] = useState('')
|
||||
const [appSecret, setAppSecret] = useState('')
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [error, setError] = useState('')
|
||||
const [result, setResult] = useState<WhatsAppSignupResult | null>(null)
|
||||
|
|
@ -21,9 +22,11 @@ export function WhatsAppTokenPage() {
|
|||
access_token: token.trim(),
|
||||
waba_id: wabaId.trim(),
|
||||
phone_number_id: phoneNumberId.trim() || null,
|
||||
app_secret: appSecret.trim() || null,
|
||||
})
|
||||
setResult(payload)
|
||||
setToken('')
|
||||
setAppSecret('')
|
||||
if (payload.status === 'failed' || payload.status === 'expired') setError(payload.message)
|
||||
} catch (reason) {
|
||||
setError(reason instanceof Error ? reason.message : 'This token could not be saved')
|
||||
|
|
@ -61,6 +64,11 @@ export function WhatsAppTokenPage() {
|
|||
<span>Optional. Use it when the account has more than one number.</span>
|
||||
<input value={phoneNumberId} onChange={(event) => setPhoneNumberId(event.target.value)} inputMode="numeric" />
|
||||
</label>
|
||||
<label className="explorer-input">
|
||||
<strong>App secret</strong>
|
||||
<span>From the Meta app that created this token, under App settings → Basic. Replies are signed with it. Skip this when the token already belongs to the Urmi app.</span>
|
||||
<input type="password" value={appSecret} onChange={(event) => setAppSecret(event.target.value)} autoComplete="off" />
|
||||
</label>
|
||||
<button className="primary-button" type="submit" disabled={busy}>
|
||||
{busy ? <Loader2 size={16} className="wa-spin" /> : null}
|
||||
Save token
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue