Skip to content

New Components - slicktext #16596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions components/slicktext/actions/edit-contact/edit-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import slicktext from "../../slicktext.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/slicktext/actions/edit-contact/edit-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "slicktext-edit-contact",
name: "Edit Contact",
description: "Updates personal details of an existing contact. [See the documentation](https://api.slicktext.com/docs/v1/contacts#6)",
version: "0.0.{{ts}}",

Check warning on line 8 in components/slicktext/actions/edit-contact/edit-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
slicktext,
contactId: {
propDefinition: [
slicktext,
"contactId",
],
},
name: {
propDefinition: [
slicktext,
"name",
],
optional: true,
},
emailAddress: {
propDefinition: [
slicktext,
"emailAddress",
],
optional: true,
},
city: {
propDefinition: [
slicktext,
"city",
],
optional: true,
},
state: {
propDefinition: [
slicktext,
"state",
],
optional: true,
},
zipCode: {
propDefinition: [
slicktext,
"zipCode",
],
optional: true,
},
country: {
propDefinition: [
slicktext,
"country",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.slicktext.updateContact({
contactId: this.contactId,
name: this.name,
emailAddress: this.emailAddress,
city: this.city,
state: this.state,
zipCode: this.zipCode,
country: this.country,
});

$.export("$summary", `Successfully updated contact with ID: ${this.contactId}`);
return response;
},
};
88 changes: 88 additions & 0 deletions components/slicktext/actions/opt-in-contact/opt-in-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import slicktext from "../../slicktext.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/slicktext/actions/opt-in-contact/opt-in-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "slicktext-opt-in-contact",
name: "Opt-In Contact",
description: "Add a new contact to your messaging list with a confirmation text. [See the documentation](https://api.slicktext.com/docs/v1/contacts)",
version: "0.0.{{ts}}",

Check warning on line 8 in components/slicktext/actions/opt-in-contact/opt-in-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
slicktext,
contactNumber: {
propDefinition: [
slicktext,
"contactNumber",
],
},
textwordId: {
propDefinition: [
slicktext,
"textwordId",
],
},
doubleOptInMessage: {
type: "string",
label: "Double Opt-In Message",
description: "The confirmation message sent to the contact. They will need to reply YES to complete subscription. Must be 160 characters or less.",
optional: true,
},
name: {
propDefinition: [
slicktext,
"name",
],
optional: true,
},
emailAddress: {
propDefinition: [
slicktext,
"emailAddress",
],
optional: true,
},
city: {
propDefinition: [
slicktext,
"city",
],
optional: true,
},
state: {
propDefinition: [
slicktext,
"state",
],
optional: true,
},
zipCode: {
propDefinition: [
slicktext,
"zipCode",
],
optional: true,
},
country: {
propDefinition: [
slicktext,
"country",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.slicktext.addContact({
contactNumber: this.contactNumber,
textwordId: this.textwordId,
doubleOptInMessage: this.doubleOptInMessage,
name: this.name,
emailAddress: this.emailAddress,
city: this.city,
state: this.state,
zipCode: this.zipCode,
country: this.country,
});
$.export("$summary", `Successfully initiated opt-in for contact with number: ${this.contactNumber}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import slicktext from "../../slicktext.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/slicktext/actions/send-message-to-contact/send-message-to-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "slicktext-send-message-to-contact",
name: "Send Message to Contact",
description: "Deliver a text message to a single contact. [See the documentation](https://api.slicktext.com/docs/v1/messages)",
version: "0.0.1",
type: "action",
props: {
slicktext,
contactNumber: {
propDefinition: [
slicktext,
"contactNumber",
],
},
messageContent: {
propDefinition: [
slicktext,
"messageContent",
],
},
textwordId: {
propDefinition: [
slicktext,
"textwordId",
],
},
},
async run({ $ }) {
const response = await this.slicktext.sendMessage({
contactNumber: this.contactNumber,
messageContent: this.messageContent,
textwordId: this.textwordId,
});

const messageId = response.messageId || response.id || "unknown";
$.export("$summary", `Message sent successfully. Message ID: ${messageId}`);
return response;
},
};
132 changes: 132 additions & 0 deletions components/slicktext/slicktext.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "slicktext",
propDefinitions: {
contactId: {
type: "string",
label: "Contact ID",
description: "The ID of the contact to be updated",
},
contactNumber: {
type: "string",
label: "Contact Number",
description: "The phone number of the contact. Must be at least 10 digits.",
},
messageContent: {
type: "string",
label: "Message Content",
description: "The body of the text message you want to send.",
},
textwordId: {
type: "string",
label: "Textword ID",
description: "The ID of the textword",
async options() {
const response = await this._makeRequest({
path: "/textwords",
});
return response.textwords.map((textword) => ({
label: textword.word,
value: textword.id,
}));
},
},
name: {
type: "string",
label: "Name",
description: "The name of the contact",
optional: true,
},
emailAddress: {
type: "string",
label: "Email Address",
description: "The email address of the contact",
optional: true,
},
city: {
type: "string",
label: "City",
description: "The city of the contact",
optional: true,
},
state: {
type: "string",
label: "State",
description: "The state of the contact",
optional: true,
},
zipCode: {
type: "string",
label: "Zip Code",
description: "The zip code of the contact",
optional: true,
},
country: {
type: "string",
label: "Country",
description: "The country of the contact",
optional: true,
},
},
methods: {
_baseUrl() {
return "https://api.slicktext.com/v1";
},
async _makeRequest(opts = {}) {
const {
$ = this,
method = "POST",
path = "/",
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
method,
url: this._baseUrl() + path,
headers: {
...headers,
"Authorization": `Bearer ${this.$auth.api_key}`,
"Content-Type": "application/x-www-form-urlencoded",
},
});
},
async updateContact(opts = {}) {
return this._makeRequest({
path: "/contacts",
data: {
action: "EDIT",
contactId: opts.contactId,
name: opts.name,
emailAddress: opts.emailAddress,
city: opts.city,
state: opts.state,
zipCode: opts.zipCode,
country: opts.country,
},
});
},
async sendMessage(opts = {}) {
return this._makeRequest({
path: "/messages",
data: {
action: "SEND",
contactNumber: opts.contactNumber,
messageContent: opts.messageContent,
textwordId: opts.textwordId,
},
});
},
async addContact(opts = {}) {
return this._makeRequest({
path: "/contacts",
data: {
action: "DOUBLEOPTIN",
contactNumber: opts.contactNumber,
},
});
},
},
};
Loading