Skip to content

Finish the OAuth flow: exchange the code, store the encrypted token and create the connection

POST
/v1/brands/{brand}/channel-connections/whatsapp/oauth/finish
curl --request POST \
--url https://api.replifier.com/v1/brands/brd_01hx0000000000000000000000/channel-connections/whatsapp/oauth/finish \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "code": "example", "state": "example", "redirectUri": "example", "name": "example", "mode": "new_number", "wabaId": "example", "phoneNumberId": "example" }'
brand
required
string
/^brd_[a-z0-9]{26}$/

Example

brd_01hx0000000000000000000000
Media typeapplication/json
object
code
required
string
>= 1 characters <= 512 characters
state
required
string
>= 1 characters <= 512 characters
redirectUri
string
<= 512 characters
name
required
string
>= 1 characters <= 120 characters /^[^\x00-\x1f\x7f]*$/
mode
string
default: new_number
Allowed values: new_number coexistence
wabaId
required
string
/^[A-Za-z0-9_-]{1,64}$/
phoneNumberId
string
/^[A-Za-z0-9_-]{1,64}$/

Connection created

Media typeapplication/json
object
id
required
string
organizationId
required
string
brandId
required
string
nullable
provider
required
string
Allowed values: whatsapp
channel
required
string
Allowed values: whatsapp
name
required
string
status
required
string
Allowed values: pending active error disabled
createdAt
required
string
updatedAt
required
string

Example

{
"provider": "whatsapp",
"channel": "whatsapp",
"status": "pending"
}

Invalid data

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

No session, expired session, or invalid, expired or revoked API key

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

Not allowed, API key missing the scope, IP not allowed, or request rejected (csrf_rejected)

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

Does not exist or is not visible to you

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

Internal error

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

Service temporarily unavailable

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}