Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Add support for webhooks

Acho Arnold07807c8ac8fc
diff --git a/web/pages/settings/index.vue b/web/pages/settings/index.vue
index dcfe16ab..ba38e8dd 100644
--- a/web/pages/settings/index.vue
+++ b/web/pages/settings/index.vue
@@ -479,7 +479,7 @@ export default Vue.extend({
methods: {
showEditPhone(phoneId: string) {
const phone = this.$store.getters.getPhones.find(
- (x: Phone) => x.id === phoneId,
+ (x: Phone) => x.id === phoneId
)
if (!phone) {
return
@@ -491,7 +491,7 @@ export default Vue.extend({
onWebhookEdit(webhookId: string) {
const webhook = this.webhooks.find(
- (x: EntitiesWebhook) => x.id === webhookId,
+ (x: EntitiesWebhook) => x.id === webhookId
)
if (!webhook) {
return
diff --git a/web/plugins/errors.ts b/web/plugins/errors.ts
index 437b641f..813c6b63 100644
--- a/web/plugins/errors.ts
+++ b/web/plugins/errors.ts
@@ -21,7 +21,7 @@ const sanitize = (key: string, values: Array<string>): Array<string> => {
.split(' char')
.join(' character')
.split(' field ')
- .join(' '),
+ .join(' ')
)
})
}
diff --git a/web/store/index.ts b/web/store/index.ts
index d317f9bf..f48d8f19 100644
--- a/web/store/index.ts
+++ b/web/store/index.ts
@@ -360,7 +360,7 @@ export const actions = {
fcm_token: phone.fcm_token,
phone_number: phone.phone_number,
message_expiration_seconds: parseInt(
- phone.message_expiration_seconds.toString(),
+ phone.message_expiration_seconds.toString()
),
max_send_attempts: parseInt(phone.max_send_attempts.toString()),
messages_per_minute: parseInt(phone.messages_per_minute.toString()),
@@ -380,7 +380,7 @@ export const actions = {
async handleAxiosError(
context: ActionContext<State, State>,
- error: AxiosError,
+ error: AxiosError
) {
const errorMessage =
error.response?.data?.data[Object.keys(error.response?.data?.data)[0]][0]
@@ -415,7 +415,7 @@ export const actions = {
async sendMessage(
context: ActionContext<State, State>,
- request: SendMessageRequest,
+ request: SendMessageRequest
) {
await axios.post('/v1/messages/send', request)
await Promise.all([
@@ -430,7 +430,7 @@ export const actions = {
addNotification(
context: ActionContext<State, State>,
- request: NotificationRequest,
+ request: NotificationRequest
) {
context.commit('setNotification', request)
},
@@ -445,7 +445,7 @@ export const actions = {
async loadThreadMessages(
context: ActionContext<State, State>,
- threadId: string | null,
+ threadId: string | null
) {
await context.commit('setThreadId', threadId)
const response = await axios.get('/v1/messages', {
@@ -460,7 +460,7 @@ export const actions = {
async setAuthUser(
context: ActionContext<State, State>,
- user: AuthUser | null | undefined,
+ user: AuthUser | null | undefined
) {
const userChanged = user?.id !== context.getters.getAuthUser?.id
@@ -477,7 +477,7 @@ export const actions = {
])
const phone = context.getters.getPhones.find(
- (x: Phone) => x.id === context.getters.getUser.active_phone_id,
+ (x: Phone) => x.id === context.getters.getUser.active_phone_id
)
if (phone) {
await context.dispatch('setOwner', phone.phone_number)
@@ -487,7 +487,7 @@ export const actions = {
async onAuthStateChanged(
context: ActionContext<State, State>,
// @ts-ignore
- { authUser },
+ { authUser }
) {
if (authUser == null) {
context.commit('setAuthUser', null)
@@ -520,7 +520,7 @@ export const actions = {
async updateThread(
context: ActionContext<State, State>,
- payload: { threadId: string; isArchived: boolean },
+ payload: { threadId: string; isArchived: boolean }
) {
await axios.put(`/v1/message-threads/${payload.threadId}`, {
is_archived: payload.isArchived,
@@ -573,7 +573,7 @@ export const actions = {
createWebhook(
context: ActionContext<State, State>,
- payload: RequestsWebhookStore,
+ payload: RequestsWebhookStore
) {
return new Promise<EntitiesWebhook>((resolve, reject) => {
axios
@@ -621,7 +621,7 @@ export const actions = {
updateWebhook(
context: ActionContext<State, State>,
- payload: RequestsWebhookUpdate & { id: string },
+ payload: RequestsWebhookUpdate & { id: string }
) {
return new Promise<EntitiesWebhook>((resolve, reject) => {
axios