SDK reference · Node SDK
prov.mandate.approvers.invite
prov.mandate.approvers.invite in Node SDK. Invite a contact you already hold (a phone, an email or both).
Signature
prov.mandate.approvers.invite(params: InviteApproverParams): Promise<ApproverLink>Parameters
paramsInviteApproverParamsRequired
Request fields
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
contactobject | stringRequired- Who the invite goes to:
{ phone, email }(one or both, the same rule as every request), or one string holding an email or an E.164 phone. Required, withdelivery: selftoo.Show child attributes
phonestring- An E.164 phone number (
+14155550132). Spaces are removed; nothing else is guessed. emailstring- An email address, compared in lower case.
text_consentobject- With
phone: your statement that the person at this phone agreed to your texts, recorded with the request (the same record asPOST /v1/account/text_consents). Needs the consent modecompany(409text_consent_mode_mismatchotherwise) and the Pro plan or higher. Read on capture requests, checkout approvals and checkout assessments; refused on an approver invite.Show child attributes
methodenumRequired- How the person agreed. One of
sign_up_form,in_app,in_person,customer_list. obtained_attimestampRequired- When they agreed; not in the future.
evidence_urlstring- An
httpslink to how they agreed. Stored, never fetched.
deliveryenumsend: Provenance sends the request on the channelschannelsallows.self: link only. Nothing is sent and the response returns the link for you to pass on. Left out, a request with no contact is link only and any other takes your account's default (sendout of the box). With a default of link only, a request that gives a contact must saysend. One ofsend,self.channelsarray of enums- Which of Provenance's messages may go, in any order:
app_notification(the person's Provenance app, when the contact matches one person there),emailandtext. Left out, your account's default (all three out of the box). With all three, the person gets the app notification and the email when their contact matches, and the text and the email otherwise; a narrower list sends only what it names (the text goes in the notification's place only withtext, the email beside either only withemail). Each message is reported on its own indeliveries. A list that can reach none of the contacts is refused, as aresmsandapp_push. follow_up_textobject- The follow-up text after the invite's app notification. An invite has no expiry, so any wait from 1 to 1440 minutes is accepted. On a live deployment it is Pro and above (
402 plan_requiredon Free); in the sandbox it works on every plan. Refused besidedelivery: "self".Show child attributes
enabledbooleanfalsesends no follow-up text.whenenumnot_opened(the default) ornot_finished. One ofnot_opened,not_finished.after_minutesinteger- A whole number of minutes from 1 to 1440, counted from the notification. On a create it must be shorter than the request's
expires_in(400 parameter_invalidonfollow_up_text.after_minutes); a longer wait from your default is kept, and the text is skipped asexpiredif the request ends first.
grantobject- What the integrator will ask the approver to approve.
Show child attributes
action_typesarray of strings- The action types allowed.
max_amountnumber- The largest amount allowed per action.
productsarray of strings- The products enabled for the account.
ask_appboolean- The invite page says "{Company} asks you to approve with the Provenance app", with the store links once they're live.
Returns
Promise<ApproverLink> The invite, with the delivery in force (channels, follow_up_text) and each message in deliveries.
HTTP operation
POST /v1/mandate/approver_links: Invite an approver
Errors
- approver_network_disabled
- authentication_required
- insufficient_role
- invalid_json
- invite_declined
- parameter_invalid
- parameter_missing
- plan_required
- rate_limit_exceeded
- recent_two_factor_required
- usage_limit_reached
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/text_consent`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "mode": "company", "everyone": null }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_links`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"contact": {
"phone": "+14155550148",
"email": "dana@example.com"
},
"grant": {
"max_amount": 1000,
"action_types": [
"payment"
]
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/account/text_consent", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"mode": "company",
"everyone": None
}).json()
data = httpx.post(f"{api}/v1/mandate/approver_links", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"contact": {
"phone": "+14155550148",
"email": "dana@example.com"
},
"grant": {
"max_amount": 1000,
"action_types": [
"payment"
]
}
}).json()