Flow
1
Create the session (your server)
POST /hosted-sessions with a purpose. The response holds the url of the page.2
Send your user to the page
Redirect them, or open the URL in a new window. Do not embed it in an iframe: the Meta login refuses it.
3
Your user completes the page
On
https://shortext.ny-corp.io/connect/{token}, they log in to Meta or fill in their mailbox settings.4
Back to your app
Shortext sends them to your
return_url with ?session_id={id}&status={status}.5
Get the result (your server)
Receive the
hosted_session.completed or hosted_session.failed webhook, or call GET /hosted-sessions/{id}. Do not trust the status of the return URL alone: anyone can type it.Purposes
GET /hosted-sessions/purposes lists them.
Create a session
Requires the Manage integrations permission.string
required
whatsapp, mail or template.object
Options of the purpose, for example
{ "agent_id": "AGI-XXXXX" }. The agent must belong to your company.string
Your page the user comes back to. HTTPS only.
string
The language of the page, for example
fr or en.integer
default:"60"
Lifetime of the link in minutes, from 5 to 1,440 (24 hours).
Response
Statuses
A session serves one outcome: once it is completed, failed, cancelled or expired, its link stops working. Create a new session to try again.
The page shows how much time is left before
expires_at; at zero, it reloads to its expired state.
Result
Forwhatsapp and mail, result lists the connected channels, in the same format as GET /channels:
id: it is the channel_id you send messages from. A channel.connected webhook is also sent for each new channel.
For template, result.template is the template, as returned by GET /templates/{id}. It is PENDING until Meta reviews it: follow it with the template.status_updated webhook. If Meta refuses the template, the page shows why and the session stays open, so your user can fix it and submit again.
Other endpoints
See the guide Connect a client’s WhatsApp.