Authentication
- API Key (otp)
- Parameter Name: Authorization, in: header. The phone number contactenated with the OTP, prefixed with
X-OTP
- Parameter Name: Authorization, in: header. The phone number contactenated with the OTP, prefixed with
Eg. if the OTP is 123456 and the phone number is 9112345, then ‘Authorization: X-OTP 9112345:123456’
- oAuth2 authentication.
- Flow: password
- Token URL = https://api-teams.twoway.ai/oauth2/token
SCOPE | SCOPE DESCRIPTION |
---|---|
TOKENS_READ | Read all tokens belonging to your account |
TOKENS_DELETE | Delete a token belonging to your account |
TEAMLINK_CREATE | Create a new invite link for the team |
TEAM_UPDATE | Modify the details of the team |
ADMIN_PANEL_ACCESS | Access admin level functionality |
USERS_PATCH | Update your personal info |
PARTNER_ADMIN_PANEL_ACCESS | Admin access to all users/teams created using a referral code |
TEAM_NOTIFY | Allow the notifying of Teams |
OAuth
Code samples
POST /token
Login to twoway.ai
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | AuthRequest | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
409 | Conflict | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» access_token | string | true | none | none |
» refresh_token | string | false | none | none |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 409
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
This operation does not require authentication
Code samples
GET /token
Fetch list of tokens
Returns in descending order of most recently used
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | [RefreshToken] | false | none | [A refresh token allows you to generate access tokens to access & update things on twoway.ai services. A refresh token will expire and become invalidated after 14 days of no activity. ] |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai ( Scopes: TOKENS_READ )
Code samples
DELETE /token
Revoke refresh tokens
If the token is not specified, all tokens of the user are revoked
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
token | query | string(uuid) | false | none |
Example responses
400 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
204 | No Content | Revoked | None |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai ( Scopes: TOKENS_DELETE )
Code samples
POST /token/external
Login via an external partner
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | ExternalTokenRequest | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | ExternalTokenPostResponse |
This operation does not require authentication
Invite Links
Code samples
POST /invite-links
Create an invite link for the team
To generate an invite link for a specific set of scopes, you must also have the same set of scopes. Eg. you cannot generate a link which gives access to MESSAGE_SEND
when you don’t have access to MESSAGE_SEND
yourself. This is done for obvious security concerns.
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | object | false | none |
» scopes | body | [Scope] | true | none |
PARAMETER | VALUE |
---|---|
» scopes | WA_STATE |
» scopes | CONTACTS_READ_ASSIGNED |
» scopes | CONTACTS_READ_ALL |
» scopes | CONTACTS_EXPORT_BUTTON |
» scopes | CONTACTS_CREATE |
» scopes | CONTACTS_DELETE |
» scopes | CONTACTS_UPDATE |
» scopes | CAMPAIGNS_READ |
» scopes | CAMPAIGNS_CREATE |
» scopes | CAMPAIGNS_DELETE |
» scopes | CAMPAIGNS_UPDATE |
» scopes | KEYWORD_READ |
» scopes | KEYWORD_CREATE |
» scopes | KEYWORD_DELETE |
» scopes | KEYWORD_UPDATE |
» scopes | TEMPLATES_READ |
» scopes | TEMPLATES_CREATE |
» scopes | TEMPLATES_DELETE |
» scopes | TEMPLATES_UPDATE |
» scopes | TAGS_READ |
» scopes | TAGS_CREATE |
» scopes | TAGS_DELETE |
» scopes | TOKENS_READ |
» scopes | TOKENS_DELETE |
» scopes | USERS_PATCH |
» scopes | REFERRAL_APPLY_CREDIT |
» scopes | TEAM_UPDATE |
» scopes | ACCOUNT_CREATE |
» scopes | ACCOUNT_READ |
» scopes | ACCOUNT_DELETE |
» scopes | ACCOUNT_PATCH |
» scopes | TEAMLINK_CREATE |
» scopes | TEAMLINK_READ |
» scopes | TEAMMEMBERS_UPDATE |
» scopes | TEAMMEMBERS_READ |
» scopes | TEAM_NOTIFY |
» scopes | CHATS_ACCESS_ALL |
» scopes | CHATS_ACCESS_ASSIGNED |
» scopes | CHATS_DELETE |
» scopes | MESSAGES_SEND_TO_ASSIGNED |
» scopes | MESSAGES_SEND_TO_ALL |
» scopes | MESSAGES_SCHEDULE |
» scopes | MESSAGES_DELETE |
» scopes | GROUPS_CREATE |
» scopes | GROUPS_UPDATE |
» scopes | NOTES |
» scopes | NOTIFICATION_READ |
» scopes | NOTIFICATION_CREATE |
» scopes | NOTIFICATION_UPDATE |
» scopes | NOTIFICATION_DELETE |
» scopes | INTEGRATIONS_UPDATE |
» scopes | ADMIN_PANEL_ACCESS |
» scopes | PAYMENTS_READ |
» scopes | PAYMENTS_UPDATE |
» scopes | WA_LIVE_EVENTS |
» scopes | twoway.ai_HOOK |
» scopes | PARTNER_ADMIN_PANEL_ACCESS |
» scopes | PRODUCTS_GET |
» scopes | PRODUCTS_CREATE |
» scopes | PRODUCTS_UPDATE |
» scopes | PRODUCTS_DELETE |
» scopes | PAYMENT_INTEGRATION_READ |
» scopes | PAYMENT_INTEGRATION_WRITE |
» scopes | PAYMENT_RECORDS_READ |
» scopes | PAYMENT_RECORDS_WRITE |
» scopes | METRICS_GET |
» scopes | ACCOUNTS_READ_ASSIGNED |
» scopes | AUTOCOMPLETE_GET |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | InviteLink |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai ( Scopes: TEAMLINK_CREATE )
Code samples
GET /invite-links/{id}
Get info about an invite link
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
id | path | string(uuid) | true | the invite link ID |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | InviteLink |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai
Teams
Code samples
GET /teams
Fetch teams you have access to
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
q | query | string | false | Search by name, ID, invite code, etc. |
partnership | query | string | false | Search by partnership |
onboardingScoreMin | query | integer | false | The minimum onboarding score of the teams to return |
onboardingScoreMax | query | integer | false | The maximum onboarding score of the teams to return |
createdAfter | query | Timestamp | false | Teams after a given date-time |
completedSteps | query | array[string] | false | Teams that have completed the given Steps |
id | query | array[string] | false | Fetch specific teams by ID |
userId | query | string(uuid) | false | teams that contain this user ID |
count | query | integer | false | The numbers of items to return |
page | query | integer | false | The page number |
includeTeamMembers | query | boolean | false | Should include the team members. Will only return members for which you have the TEAMMEMBERS_READ scope |
includeInviteLinks | query | boolean | false | Should include the invite links. Will only return invite links for which you have the TEAMLINKS_READ scope |
includeTotal | query | boolean | false | include the count of the total teams |
includeCreator | query | boolean | false | include the creator’s data in the API result |
partner | query | string | false | string to identify user with a partner |
returnOnboardingScore | query | boolean | false | return the onboarding score for the team |
PARAMETER | VALUE |
---|---|
completedSteps | connectedWa |
completedSteps | sentMessage |
completedSteps | usedMobileVersion |
completedSteps | invitedTeamMember |
completedSteps | createdNote |
completedSteps | createdTag |
completedSteps | createdMessageFlow |
completedSteps | sentMessageFlowByShortcut |
completedSteps | assignedChatToTeamMember |
completedSteps | scheduledAMessage |
completedSteps | createdMessageFlowWithButtons |
completedSteps | sentMessageFlowWithButtons |
completedSteps | autoTagOrAssignWithMessageFlow |
completedSteps | createdFirstBroadcast |
completedSteps | scheduledFirstBroadcast |
completedSteps | toggleOfflineBotOn |
completedSteps | createdFirstKeywordBot |
completedSteps | connectFirstIntegration |
completedSteps | importedContacts |
completedSteps | adddedACustomFieldToContact |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» total | number | false | none | none |
» teams | [Team] | true | none | none |
»»» webPushSubscriptions | [WebPushSubscription] | false | none | none |
»» name | string | true | none | none |
»» isAdmin | boolean | false | none | Is an admin team |
»» scopes | [Scope] | true | none | The max scopes allowed |
»» partnerAdmin | string¦null | false | none | The team will be the admin team of a twoway.ai partner if this property is not null. |
»» onboardingStepsDone | [OnboardingStep] | false | none | none |
»» onboardingScore | number | false | none | The onboarding score of the team. |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai
Code samples
PATCH /teams
Update the team the access token is for
- If you want to update/delete members — ensure you have the
TEAMMEMBERS_UPDATE
scope - If you want to delete invite links — ensure you have the
TEAMLINKS_UPDATE
scope - Also you cannot delete/update yourself in the team. If you attempt to do so, a 400 will be returned
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | TeamPatchRequest | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai ( Scopes: TEAM_UPDATE )
Code samples
POST /teams/completed-onboarding-step/{step}
Mark a team as having completed an onboarding step
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
step | path | OnboardingStepID | true | the onboarding step to mark as completed |
PARAMETER | VALUE |
---|---|
step | connectedWa |
step | sentMessage |
step | usedMobileVersion |
step | invitedTeamMember |
step | createdNote |
step | createdTag |
step | createdMessageFlow |
step | sentMessageFlowByShortcut |
step | assignedChatToTeamMember |
step | scheduledAMessage |
step | createdMessageFlowWithButtons |
step | sentMessageFlowWithButtons |
step | autoTagOrAssignWithMessageFlow |
step | createdFirstBroadcast |
step | scheduledFirstBroadcast |
step | toggleOfflineBotOn |
step | createdFirstKeywordBot |
step | connectFirstIntegration |
step | importedContacts |
step | adddedACustomFieldToContact |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai
Code samples
POST /teams/join
Join a team
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
id | query | string | true | inviteLink ID |
Example responses
400 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
204 | No Content | OK | None |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
404 | Not Found | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 404
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai
Code samples
PATCH /teams/partner-team-status/{teamId}
Upgrade the team to ‘partner’ if partner is specified, else, downgrade partner status
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
teamId | path | string | true | the teamId of the team to be upgraded/downgraded |
body | body | object | false | none |
» partnerAdmin | body | string¦null | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai ( Scopes: ADMIN_PANEL_ACCESS )
Users
Code samples
GET /users
Fetch users you have access to
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
q | query | string | false | Search by name, ID, email, phone etc. |
partnership | query | string | false | Search by partnership |
id | query | array[string] | false | Fetch specific users by ID |
originalTeamId | query | array[string] | false | Fetch specific users by original team ID |
count | query | integer | false | The numbers of items to return |
page | query | integer | false | The page number |
includeMemberships | query | boolean | false | Should include the user’s memberships |
includeTotal | query | boolean | false | should return total count of accessible users |
other | query | array[string] | false | other internal query options |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» total | number | false | none | none |
» users | [User] | true | none | none |
»»»» partnerAdmin | string¦null | false | none | The team will be the admin team of a twoway.ai partner if this property is not null. |
»»»» onboardingStepsDone | [OnboardingStep] | false | none | none |
»»»» onboardingScore | number | false | none | The onboarding score of the team. |
»» webPushSubscriptions | [WebPushSubscription] | false | none | none |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai
Code samples
POST /users
Create a new user
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | UserCreate | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | User |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
409 | Conflict | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 409
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: otp, twoway.ai ( Scopes: ADMIN_PANEL_ACCESS PARTNER_ADMIN_PANEL_ACCESS )
Code samples
PATCH /users
Update the user in the access token
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
userId | query | string(uuid) | false | Change the password of this user ID |
body | body | UserPatch | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | User |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai ( Scopes: USERS_PATCH )
Code samples
DELETE /users
Delete a user
Deletes the user specified
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
id | query | string(uuid) | true | none |
Example responses
401 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
204 | No Content | Deleted | None |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai ( Scopes: ADMIN_PANEL_ACCESS PARTNER_ADMIN_PANEL_ACCESS )
Code samples
PATCH /users/password
Reset user password
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | ResetPassword | false | none |
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
204 | No Content | OK | None |
To perform this operation, you must be authenticated by means of one of the following methods: otp
OTP
Code samples
POST /otp
Generate an OTP
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | object | false | none |
» phoneNumber | body | string | true | none |
» template | body | string | false | Optionally specify the OTP template type |
» captchaToken | body | string | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | OTP |
This operation does not require authentication
Code samples
POST /verify-otp
Confirm OTP while checkout products.
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | false | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: otp
Notifications
Code samples
POST /notify
Notify a team member
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
userId | query | string | false | The user to notify, leave undefined to send to team owner |
teamId | query | string | false | none |
notifyWhatsApp | query | boolean | false | Override notify on WhatsApp |
notifyEmail | query | boolean | false | Override notify on Email |
notifyDesktop | query | boolean | false | Override notify on Desktop |
body | body | NotifyRequestWithContent | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
400 | Bad Request | There was an error | Inline |
401 | Unauthorized | There was an error | Inline |
403 | Forbidden | There was an error | Inline |
404 | Not Found | There was an error | Inline |
500 | Internal Server Error | There was an error | Inline |
Status Code 400
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 401
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 403
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 404
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
Status Code 500
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» statusCode | number | false | none | none |
» error | string | false | none | Specific description of the error |
» message | string | false | none | What the error was |
» data | object | false | none | Some extra information about the error |
To perform this operation, you must be authenticated by means of one of the following methods: twoway.ai ( Scopes: TEAM_NOTIFY )
Schemas
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | none |
PROPERTY | VALUE |
---|---|
anonymous | WA_STATE |
anonymous | CONTACTS_READ_ASSIGNED |
anonymous | CONTACTS_READ_ALL |
anonymous | CONTACTS_EXPORT_BUTTON |
anonymous | CONTACTS_CREATE |
anonymous | CONTACTS_DELETE |
anonymous | CONTACTS_UPDATE |
anonymous | CAMPAIGNS_READ |
anonymous | CAMPAIGNS_CREATE |
anonymous | CAMPAIGNS_DELETE |
anonymous | CAMPAIGNS_UPDATE |
anonymous | KEYWORD_READ |
anonymous | KEYWORD_CREATE |
anonymous | KEYWORD_DELETE |
anonymous | KEYWORD_UPDATE |
anonymous | TEMPLATES_READ |
anonymous | TEMPLATES_CREATE |
anonymous | TEMPLATES_DELETE |
anonymous | TEMPLATES_UPDATE |
anonymous | TAGS_READ |
anonymous | TAGS_CREATE |
anonymous | TAGS_DELETE |
anonymous | TOKENS_READ |
anonymous | TOKENS_DELETE |
anonymous | USERS_PATCH |
anonymous | REFERRAL_APPLY_CREDIT |
anonymous | TEAM_UPDATE |
anonymous | ACCOUNT_CREATE |
anonymous | ACCOUNT_READ |
anonymous | ACCOUNT_DELETE |
anonymous | ACCOUNT_PATCH |
anonymous | TEAMLINK_CREATE |
anonymous | TEAMLINK_READ |
anonymous | TEAMMEMBERS_UPDATE |
anonymous | TEAMMEMBERS_READ |
anonymous | TEAM_NOTIFY |
anonymous | CHATS_ACCESS_ALL |
anonymous | CHATS_ACCESS_ASSIGNED |
anonymous | CHATS_DELETE |
anonymous | MESSAGES_SEND_TO_ASSIGNED |
anonymous | MESSAGES_SEND_TO_ALL |
anonymous | MESSAGES_SCHEDULE |
anonymous | MESSAGES_DELETE |
anonymous | GROUPS_CREATE |
anonymous | GROUPS_UPDATE |
anonymous | NOTES |
anonymous | NOTIFICATION_READ |
anonymous | NOTIFICATION_CREATE |
anonymous | NOTIFICATION_UPDATE |
anonymous | NOTIFICATION_DELETE |
anonymous | INTEGRATIONS_UPDATE |
anonymous | ADMIN_PANEL_ACCESS |
anonymous | PAYMENTS_READ |
anonymous | PAYMENTS_UPDATE |
anonymous | WA_LIVE_EVENTS |
anonymous | twoway.ai_HOOK |
anonymous | PARTNER_ADMIN_PANEL_ACCESS |
anonymous | PRODUCTS_GET |
anonymous | PRODUCTS_CREATE |
anonymous | PRODUCTS_UPDATE |
anonymous | PRODUCTS_DELETE |
anonymous | PAYMENT_INTEGRATION_READ |
anonymous | PAYMENT_INTEGRATION_WRITE |
anonymous | PAYMENT_RECORDS_READ |
anonymous | PAYMENT_RECORDS_WRITE |
anonymous | METRICS_GET |
anonymous | ACCOUNTS_READ_ASSIGNED |
anonymous | AUTOCOMPLETE_GET |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
scope | string | true | none | Binary representation of the scope array |
exp | number | true | none | none |
iat | number | true | none | none |
user | object | true | none | none |
Login with Boutir
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
type | string | true | none | none |
username | string | true | none | none |
password | string | true | none | none |
referralCode | string | false | none | none |
PROPERTY | VALUE |
---|---|
type | boutir |
Login with Firebase
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
type | string | true | none | none |
idToken | string | true | none | none |
referralCode | string | false | none | none |
PROPERTY | VALUE |
---|---|
type | firebase |
oneOf
xor
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
access_token | string | true | none | none |
refresh_token | string | false | none | none |
allOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | object | false | none | none |
» created | boolean | false | none | Was the user just created |
and
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
phoneNumber | number | true | none | none |
returnRefreshToken | boolean | false | none | none |
password | string | true | none | Base64 encoded SHA256 of the plaintext password, or the plaintext itself. See “passwordEncoding” below |
passwordEncoding | string | false | none | describe how the password is encoded |
teamId | string(uuid) | false | none | The team ID to generate the token for, lastUsedTeam will be used otherwise |
scopes | [Scope] | false | none | none |
PROPERTY | VALUE |
---|---|
passwordEncoding | shaBase64 |
passwordEncoding | plaintext |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
refreshToken | string | true | none | none |
teamId | string(uuid) | true | none | The team ID to generate the token for, lastUsedTeam will be used otherwise |
scopes | [Scope] | false | none | none |
oneOf
xor
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
title | string | true | none | none |
content | string | true | none | none |
overrides | object | false | none | none |
object | false | none | none | |
»» botId | string | true | none | none |
parameters | object | false | none | none |
» additionalProperties | any | false | none | none |
A refresh token allows you to generate access tokens to access & update things on twoway.ai services. A refresh token will expire and become invalidated after 14 days of no activity.
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
token | string | true | none | none |
userId | string | true | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
boolean | false | none | none | |
boolean | false | none | none | |
desktop | boolean | false | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
password | string | true | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
endpoint | string | true | none | none |
authKey | string | true | none | none |
p256dhKey | string | true | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
fullName | string | false | none | none |
emailAddress | string(email)¦null | false | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
fullName | string | true | none | none |
phoneNumber | number | true | none | Will only contain numbers, no + sign, brackets etc. |
password | string | true | none | SHA256 of the plaintext password pls |
emailAddress | string(email)¦null | false | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | none |
PROPERTY | VALUE |
---|---|
anonymous | admin-panel |
anonymous | otp |
anonymous | boutir |
anonymous | instant-reg |
anonymous | firebase |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
id | string(uuid) | true | none | none |
None
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
companyName | string | false | none | none |
companyEmailAddress | string | false | none | none |
companyWebsite | string | false | none | none |
industry | string | false | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
id | string | true | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
id | string(uuid) | true | none | none |
None
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | none |
PROPERTY | VALUE |
---|---|
anonymous | connectedWa |
anonymous | sentMessage |
anonymous | usedMobileVersion |
anonymous | invitedTeamMember |
anonymous | createdNote |
anonymous | createdTag |
anonymous | createdMessageFlow |
anonymous | sentMessageFlowByShortcut |
anonymous | assignedChatToTeamMember |
anonymous | scheduledAMessage |
anonymous | createdMessageFlowWithButtons |
anonymous | sentMessageFlowWithButtons |
anonymous | autoTagOrAssignWithMessageFlow |
anonymous | createdFirstBroadcast |
anonymous | scheduledFirstBroadcast |
anonymous | toggleOfflineBotOn |
anonymous | createdFirstKeywordBot |
anonymous | connectFirstIntegration |
anonymous | importedContacts |
anonymous | adddedACustomFieldToContact |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
name | string | false | none | none |
inviteLinks | [object] | false | none | none |
» id | string | true | none | none |
» delete | boolean | false | none | If set to true, will delete the invite link |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
phoneNumber | number | true | none | none |
otp | number | false | none | none |
Unique identifier for a team
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string(uuid) | false | none | Unique identifier for a team |
Unique identifier for a user
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string(uuid) | false | none | Unique identifier for a user |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string(date-time) | false | none | none |
oneOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | The error message when sending |
xor
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | boolean | false | none | If “false”, this channel was not used. If “true” — then the channel was successfully sent to |