Skip to content
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

refactor(react): whatsappTemplate #972

Merged
merged 1 commit into from
Oct 6, 2020
Merged

Conversation

AinaVendrell
Copy link
Contributor

@AinaVendrell AinaVendrell commented Oct 2, 2020

Description

Adapt WhatsappTempletes and create a new message type named whatsapptemplate.

Context

WhatsappTempletes were send as text

Approach taken / Explain the design

If rendered in the browser it shows a message with the name and the spacename, if rendered in node it sends all properties to the message with whatsapptemplate message type

To document / Usage example

WhatsappTemplate component allows to send whatsapp templates in the bot actions

Properties:
required: name (string), namespace (string), language (string)
non-required: header (object), body (object), footer (object)

Example:
In ./actions/example-whatsappTemplate.js

import React from 'react'
import { WhatsappTemplate } from '@botonic/react'

export default class extends React.Component {
  render() {
    return (
      <WhatsappTemplate
        name={'out_of_office'}
        namespace={'d32863cc_3dd6_3e84_74c0_38d758fc60f6'}
        language={'en'}
        header={''}
        body={{
          type: 'body',
          parameters: [{ type: 'text', text: 'Anthony' }],
        }}
        footer={''}
      ></WhatsappTemplate>
    )
  }
}

Testing

The pull request...

  • has unit tests
  • has integration tests
  • doesn't need tests because... [provide a description]

@dpinol
Copy link
Contributor

dpinol commented Oct 5, 2020

Please remove "
Set as Draft PR if it's not ready to be merged.

PR best practices Reference"
when creating new PRs

@AinaVendrell AinaVendrell force-pushed the refactor/whatsapp-template branch from 80d2ec5 to 9f3500d Compare October 5, 2020 08:35
Copy link
Contributor

@vanbasten17 vanbasten17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By looking at the example, I'm wondering...

<WhatsappTemplate
        name={'out_of_office'}
        namespace={'d32863cc_3dd6_3e84_74c0_38d758fc60f6'}
        language={'en'}
        header={''}
        body={
          '{"type": "body","parameters": [{"type": "text","text": "Anthony"}]}'
        }
        footer={''}
      ></WhatsappTemplate>

Is it possible to pass the props as objects for header, body and footer instead of a stringified version of an object? I think it will facilitate the work for us and the developers. You can let the dev pass an object and stringify it within the WhatsappTemplate component. For the rest, LGTM 👍

@AinaVendrell AinaVendrell force-pushed the refactor/whatsapp-template branch from 9f3500d to ac83b54 Compare October 5, 2020 10:45
@AinaVendrell AinaVendrell merged commit 6b95796 into master Oct 6, 2020
@AinaVendrell AinaVendrell deleted the refactor/whatsapp-template branch October 6, 2020 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants